1.0.6 • Published 2 years ago
alanngai-node-helper v1.0.6
Functions
getAllFileNameFromDir(dirPath) ⇒ array
获取文件夹下所有文件名
Kind: global function
Returns: array - 文件名列表
Param | Type | Description |
---|---|---|
dirPath | string | 文件夹路径 |
copyFile(from, to)
复制文件
Kind: global function
Param | Type | Description |
---|---|---|
from | string | 复制文件路径 |
to | string | 目标文件路径 |
getProcessParams() ⇒ array
获取 node 程序参数
Kind: global function
Returns: array - 参数列表
getFileExt(fileName) ⇒ string
Kind: global function
Returns: string - 返回文件名后缀
Param | Type | Description |
---|---|---|
fileName | string | 带后缀的文件名 |
getFileNameOnly(filePath)
通过文件路径仅获取文件名
Kind: global function
Param | Type | Description |
---|---|---|
filePath | string | 文件绝对路径 |
runShellCommand(command, shell)
执行 shell 命令
Kind: global function
Param | Type | Description |
---|---|---|
command | string | 命令 |
shell | string | 选填,shell类型 |
isSameFile(pathA, pathB)
比对两个文件(如json)(格式和内容)是否全等
Kind: global function
Param | Type | Description |
---|---|---|
pathA | string | 文件A,绝对路径 |
pathB | string | 文件B,绝对路径 |
isDir(path) ⇒ boolean
判断是否文件夹
Kind: global function
Returns: boolean - 是否为文件夹
Param | Type | Description |
---|---|---|
path | string | 文件夹绝对路径 |
getSystemName() ⇒ string
获取操作系统名,可能是 MacOS、Linux、Windows
Kind: global function
Returns: string - 系统名
createDirIfNonExist(filepath) ⇒ boolean
如果不存在则创建文件夹
Kind: global function
Returns: boolean - 完成则返回true
Param | Type | Description |
---|---|---|
filepath | string | 文件夹绝对路径 |
normalizePath(filepath) ⇒ string
把路径格式化为 xx/xx,主要是为了处理 win系统上的差异
Kind: global function
Returns: string - 格式化后的路径
Param | Type | Description |
---|---|---|
filepath | string | 文件路径 |