tw5-typed / modules/utils/filesystem
Module: modules/utils/filesystem
Table of contents
References
- TerminalColourName
- base64Decode
- base64Encode
- checkDependencies
- count
- deepCopy
- deepFreeze
- encodeURIComponentExtended
- endsWith
- entityDecode
- escape
- escapeRegExp
- extend
- extendDeepCopy
- extractVersionInfo
- findFollowingLineBreak
- findPrecedingLineBreak
- formatDateString
- formatTitleString
- getAmPm
- getAnimationDuration
- getDaySuffix
- getHours12
- getInt
- getRelativeDate
- getSystemInfo
- getWeek
- getYearForWeekNo
- hashString
- hopArray
- htmlEncode
- htmlTextEncode
- hyphenateCss
- isLinkExternal
- isValidFieldName
- jsonStringify
- log
- logTable
- makeCompareFunction
- makeDataUri
- makeTiddlerDictionary
- nextTick
- parseInt
- parseNumber
- parseTextReference
- removeArrayEntries
- repeat
- replaceString
- sign
- slowInSlowOut
- startsWith
- stringEndsWith
- stringify
- stringifyNumber
- tagToCssSelector
- terminalColour
- terminalColourLookup
- timer
- toSentenceCase
- toTitleCase
- trim
- trimPrefix
- trimSuffix
- unHyphenateCss
- unescapeLineBreaks
- warning
Functions
- copyDirectory
- copyFile
- createDirectory
- createFileDirectories
- deleteDirectory
- deleteEmptyDirectories
- generateTiddlerExtension
- generateTiddlerFileInfo
- generateTiddlerFilepath
- getSubdirectories
- isDirectory
- isDirectoryEmpty
- removeTrailingSeparator
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
Name | Type | Description |
---|---|---|
sourcePath | string | - |
directoryPath | string | The 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
Name | Type | Description |
---|---|---|
sourcePath | string | - |
directoryPath | string | The 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
Name | Type | Description |
---|---|---|
directoryPath | string | The 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
Name | Type | Description |
---|---|---|
filePath | string | The 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
Name | Type | Description |
---|---|---|
directoryPath | string | The 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
Name | Type | Description |
---|---|---|
directoryPath | string | The path of the directory to delete |
callback | (error : Error ) => void | A 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
Name | Type | Description |
---|---|---|
title | string | The title of the tiddler |
options | Object | Options 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
Name | Type | Description |
---|---|---|
tiddler | Tiddler | The tiddler to generate the fileInfo for |
options | Object | Options for generating the fileInfo |
options.directory | string | - |
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
Name | Type |
---|---|
title | string |
options | Object |
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
Name | Type | Description |
---|---|---|
directoryPath | string | The 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
Name | Type | Description |
---|---|---|
directoryPath | string | The 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
Name | Type | Description |
---|---|---|
directoryPath | string | The 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
Name | Type | Description |
---|---|---|
directoryPath | string | The directory path to remove the trailing separator from |
Returns
string
The directory path without the trailing separator
Description
移除路径末尾的分隔符