API Reference / api/jse/File / FileAPI
Class: FileAPI
Defined in: api/jse/File.d.ts:7
文件操作API
Methods
copyFile()
static copyFile(source, target): boolean
Defined in: api/jse/File.d.ts:33
复制文件
Parameters
source
string
源文件路径
target
string
目标文件路径
Returns
boolean
createDirectory()
static createDirectory(path): boolean
Defined in: api/jse/File.d.ts:27
创建文件夹
Parameters
path
string
文件夹路径
Returns
boolean
delete()
static delete(path): boolean
Defined in: api/jse/File.d.ts:49
删除文件/文件夹
Parameters
path
string
文件/文件夹路径
Returns
boolean
exists()
static exists(path): boolean
Defined in: api/jse/File.d.ts:55
文件/文件夹是否存在
Parameters
path
string
文件/文件夹路径
Returns
boolean
getFileSize()
static getFileSize(path): number
Defined in: api/jse/File.d.ts:73
获取文件大小
Parameters
path
string
文件路径
Returns
number
isDirectory()
static isDirectory(path): boolean
Defined in: api/jse/File.d.ts:61
路径是否为文件夹
Parameters
path
string
文件/文件夹路径
Returns
boolean
isFile()
static isFile(path): boolean
Defined in: api/jse/File.d.ts:67
路径是否为文件
Parameters
path
string
文件/文件夹路径
Returns
boolean
listDirectory()
static listDirectory(path): string[]
Defined in: api/jse/File.d.ts:79
获取文件/文件夹列表
Parameters
path
string
文件夹路径
Returns
string
[]
moveFile()
static moveFile(source, target): boolean
Defined in: api/jse/File.d.ts:41
移动文件
Parameters
source
string
源文件路径
target
string
目标文件路径
Returns
boolean
readFile()
static readFile(path, isBinary?): string
Defined in: api/jse/File.d.ts:9
读取文件
Parameters
path
string
文件路径
isBinary?
boolean
以二进制读取
Returns
string
writeFile()
static writeFile(
path,
content,
isBinary?): boolean
Defined in: api/jse/File.d.ts:17
写入文件
Parameters
path
string
文件路径
content
string
文件内容
isBinary?
boolean
以二进制写入
Returns
boolean