Skip to main content

tw5-typed / modules/utils/filesystem

Module: modules/utils/filesystem

Table of contents

References

Functions

References

TerminalColourName

Re-exports TerminalColourName


base64Decode

Re-exports base64Decode


base64Encode

Re-exports base64Encode


checkDependencies

Re-exports checkDependencies


count

Re-exports count


deepCopy

Re-exports deepCopy


deepFreeze

Re-exports deepFreeze


encodeURIComponentExtended

Re-exports encodeURIComponentExtended


endsWith

Re-exports endsWith


entityDecode

Re-exports entityDecode


escape

Re-exports escape


escapeRegExp

Re-exports escapeRegExp


extend

Re-exports extend


extendDeepCopy

Re-exports extendDeepCopy


extractVersionInfo

Re-exports extractVersionInfo


findFollowingLineBreak

Re-exports findFollowingLineBreak


findPrecedingLineBreak

Re-exports findPrecedingLineBreak


formatDateString

Re-exports formatDateString


formatTitleString

Re-exports formatTitleString


getAmPm

Re-exports getAmPm


getAnimationDuration

Re-exports getAnimationDuration


getDaySuffix

Re-exports getDaySuffix


getHours12

Re-exports getHours12


getInt

Re-exports getInt


getRelativeDate

Re-exports getRelativeDate


getSystemInfo

Re-exports getSystemInfo


getWeek

Re-exports getWeek


getYearForWeekNo

Re-exports getYearForWeekNo


hashString

Re-exports hashString


hopArray

Re-exports hopArray


htmlEncode

Re-exports htmlEncode


htmlTextEncode

Re-exports htmlTextEncode


hyphenateCss

Re-exports hyphenateCss


isLinkExternal

Re-exports isLinkExternal


isValidFieldName

Re-exports isValidFieldName


jsonStringify

Re-exports jsonStringify


log

Re-exports log


logTable

Re-exports logTable


makeCompareFunction

Re-exports makeCompareFunction


makeDataUri

Re-exports makeDataUri


makeTiddlerDictionary

Re-exports makeTiddlerDictionary


nextTick

Re-exports nextTick


parseInt

Re-exports parseInt


parseNumber

Re-exports parseNumber


parseTextReference

Re-exports parseTextReference


removeArrayEntries

Re-exports removeArrayEntries


repeat

Re-exports repeat


replaceString

Re-exports replaceString


sign

Re-exports sign


slowInSlowOut

Re-exports slowInSlowOut


startsWith

Re-exports startsWith


stringEndsWith

Re-exports stringEndsWith


stringify

Re-exports stringify


stringifyNumber

Re-exports stringifyNumber


tagToCssSelector

Re-exports tagToCssSelector


terminalColour

Re-exports terminalColour


terminalColourLookup

Re-exports terminalColourLookup


timer

Re-exports timer


toSentenceCase

Re-exports toSentenceCase


toTitleCase

Re-exports toTitleCase


trim

Re-exports trim


trimPrefix

Re-exports trimPrefix


trimSuffix

Re-exports trimSuffix


unHyphenateCss

Re-exports unHyphenateCss


unescapeLineBreaks

Re-exports unescapeLineBreaks


warning

Re-exports warning

Functions

copyDirectory

copyDirectory(sourcePath, directoryPath): string

Recursively (and synchronously) copy a directory and all its content

Parameters

NameTypeDescription
sourcePathstring-
directoryPathstringThe destination path of the directory to copy

Returns

string

An error message if there is an error, otherwise null

Description

递归地(同步地)复制目录及其所有内容

Defined in

src/modules/utils/filesystem.d.ts:21


copyFile

copyFile(sourcePath, directoryPath): string

Copy a file

Parameters

NameTypeDescription
sourcePathstring-
directoryPathstringThe destination path of the file to copy

Returns

string

An error message if there is an error, otherwise null

Description

复制文件

Defined in

src/modules/utils/filesystem.d.ts:30


createDirectory

createDirectory(directoryPath): string

Recursively create a directory

Parameters

NameTypeDescription
directoryPathstringThe path of the directory to create

Returns

string

An error message if there is an error, otherwise null

Description

递归地创建目录

Defined in

src/modules/utils/filesystem.d.ts:46


createFileDirectories

createFileDirectories(filePath): string

Recursively create directories needed to contain a specified file

Parameters

NameTypeDescription
filePathstringThe path of the file to create directories for

Returns

string

An error message if there is an error, otherwise null

Description

递归地创建包含指定文件的目录

Defined in

src/modules/utils/filesystem.d.ts:54


deleteDirectory

deleteDirectory(directoryPath): string

Recursively delete a directory

Parameters

NameTypeDescription
directoryPathstringThe path of the directory to delete

Returns

string

An error message if there is an error, otherwise null

Description

递归地删除目录

Defined in

src/modules/utils/filesystem.d.ts:62


deleteEmptyDirectories

deleteEmptyDirectories(directoryPath, callback): void

Recursively delete a tree of empty directories

Parameters

NameTypeDescription
directoryPathstringThe path of the directory to delete
callback(error: Error) => voidA callback function to call when the operation is complete

Returns

void

Description

递归地删除空目录树

Defined in

src/modules/utils/filesystem.d.ts:86


generateTiddlerExtension

generateTiddlerExtension(title, options): string

Generate the file extension for saving a tiddler

Parameters

NameTypeDescription
titlestringThe title of the tiddler
optionsObjectOptions for generating the file extension
options.extFilters?string[]-
options.wiki?Wiki-

Returns

string

The file extension

Description

生成用于保存 tiddler 的文件扩展名 可选项包括: extFilters:用于生成扩展名的可选过滤器数组 wiki:用于评估 extFilters 的可选 wiki

Defined in

src/modules/utils/filesystem.d.ts:119


generateTiddlerFileInfo

generateTiddlerFileInfo(tiddler, options): FileInfo

Generate a fileInfo object for saving a tiddler

Parameters

NameTypeDescription
tiddlerTiddlerThe tiddler to generate the fileInfo for
optionsObjectOptions for generating the fileInfo
options.directorystring-
options.extFilters?string[]-
options.fileInfo?FileInfo-
options.pathFilters?string[]-
options.wiki?Wiki-

Returns

FileInfo

A fileInfo object

Description

生成用于保存 tiddler 的 fileInfo 对象

Defined in

src/modules/utils/filesystem.d.ts:98


generateTiddlerFilepath

generateTiddlerFilepath(title, options): string

Generate the filepath for saving a tiddler Options include:

  • extension: file extension to be added the finished filepath
  • directory: absolute path of root directory to which we are saving
  • pathFilters: optional array of filters to be used to generate the base path
  • wiki: optional wiki for evaluating the pathFilters
  • fileInfo: an existing fileInfo object to check against

Parameters

NameType
titlestring
optionsObject
options.extFilters?string[]
options.wiki?Wiki

Returns

string

Defined in

src/modules/utils/filesystem.d.ts:135


getSubdirectories

getSubdirectories(directoryPath): string[]

Return the subdirectories of a path

Parameters

NameTypeDescription
directoryPathstringThe path to the directory

Returns

string[]

An array of subdirectories

Description

返回路径的子目录

Defined in

src/modules/utils/filesystem.d.ts:12


isDirectory

isDirectory(directoryPath): boolean

Check if a path identifies a directory

Parameters

NameTypeDescription
directoryPathstringThe path to check

Returns

boolean

True if the path identifies a directory, false otherwise

Description

检查路径是否标识目录

Defined in

src/modules/utils/filesystem.d.ts:70


isDirectoryEmpty

isDirectoryEmpty(directoryPath): boolean

Check if a path identifies a directory that is empty

Parameters

NameTypeDescription
directoryPathstringThe path to check

Returns

boolean

True if the path identifies an empty directory, false otherwise

Description

检查路径是否标识空目录

Defined in

src/modules/utils/filesystem.d.ts:78


removeTrailingSeparator

removeTrailingSeparator(directoryPath): string

Remove trailing path separator

Parameters

NameTypeDescription
directoryPathstringThe directory path to remove the trailing separator from

Returns

string

The directory path without the trailing separator

Description

移除路径末尾的分隔符

Defined in

src/modules/utils/filesystem.d.ts:38