import * as lCore from './core'; /** * --- 初始化系统级 ID,仅能设置一次 --- * @param id 系统级 ID */ export declare function initSysId(id: string): void; /** * --- 挂载到 mounted 目录下 --- * @param current 当前任务 id * @param name 目录名 * @param handler 回调相关 */ export declare function mount(current: lCore.TCurrent, name: string, handler: IMountHandler): boolean; /** * --- 卸载 mounted --- * @param name 目录名 */ export declare function unmount(name: string): Promise; export declare function getContent(current: lCore.TCurrent | null, path: string, options?: { 'start'?: number; 'end'?: number; 'progress'?: (loaded: number, total: number) => void | Promise; /** --- 网络模式下携带后缀,如 ?123 --- */ 'after'?: string; }): Promise; export declare function getContent(current: lCore.TCurrent | null, path: string, options: BufferEncoding | { 'encoding': BufferEncoding; 'start'?: number; 'end'?: number; 'progress'?: (loaded: number, total: number) => void | Promise; }): Promise; /** * --- 写入文件内容 --- * @param current 当前任务 id * @param path 文件路径 * @param data 要写入的内容 * @param options 选项 */ export declare function putContent(current: lCore.TCurrent, path: string, data: string | Blob, options?: { 'encoding'?: BufferEncoding | null; 'mode'?: string | number; 'flag'?: string | number; }): Promise; /** * --- 读取链接的 target --- * @param current 当前任务 id * @param path 要读取的路径 * @param encoding 编码 */ export declare function readLink(current: lCore.TCurrent, path: string, encoding?: BufferEncoding): Promise; /** * --- 把源文件创建一个 link --- * @param current 当前任务 id * @param filePath 源文件 * @param linkPath 连接路径 * @param type 选项 */ export declare function symlink(current: lCore.TCurrent, filePath: string, linkPath: string, type?: 'dir' | 'file' | 'junction'): Promise; /** * --- 删除一个文件 --- * @param current 当前任务 id * @param path 要删除的文件路径 */ export declare function unlink(current: lCore.TCurrent, path: string): Promise; /** * --- 获取对象是否存在,存在则返回 stats 对象,否则返回 null --- * @param current 当前任务 id * @param path 对象路径 */ export declare function stats(current: lCore.TCurrent, path: string): Promise; /** * --- 判断是否是目录或目录是否存在,是的话返回 stats --- * @param current 当前任务 id * @param path 判断路径 */ export declare function isDir(current: lCore.TCurrent, path: string): Promise; /** * --- 判断是否是文件或文件是否存在,是的话返回 stats --- * @param current 当前任务 id * @param path 判断路径 */ export declare function isFile(current: lCore.TCurrent, path: string): Promise; /** * --- 深度创建目录,如果最末目录存在,则自动创建成功 --- * @param current 当前任务 id * @param path 要创建的路径,如 /a/b/c/ * @param mode 权限 */ export declare function mkdir(current: lCore.TCurrent, path: string, mode?: number): Promise; /** * --- 删除空目录 --- * @param current 当前任务 id * @param path 要删除的目录 */ export declare function rmdir(current: lCore.TCurrent, path: string): Promise; /** * --- 删除一个非空目录 --- * --- [ Danger ] [ 危险 ] --- * @param current 当前任务 id * @param path 目录路径 */ export declare function rmdirDeep(current: lCore.TCurrent, path: string): Promise; /** * --- 修改权限 --- * @param current 当前任务 id * @param path 要修改的路径 * @param mod 权限 */ export declare function chmod(current: lCore.TCurrent, path: string, mod: string | number): Promise; /** * --- 重命名/移动 文件文件夹 --- * @param current 当前任务 id * @param oldPath 老名 * @param newPath 新名 */ export declare function rename(current: lCore.TCurrent, oldPath: string, newPath: string): Promise; /** * --- 获取文件夹下文件列表 --- * @param current 当前任务 id * @param path 文件夹路径 * @param encoding 编码 */ export declare function readDir(current: lCore.TCurrent, path: string, encoding?: BufferEncoding): Promise; /** * --- 复制文件夹里的内容到另一个地方,失败不会回滚 --- * @param current 当前任务 id * @param from 源,末尾加 / * @param to 目标,末尾加 / * @param ignore 忽略的文件 */ export declare function copyFolder(current: lCore.TCurrent, from: string, to: string, ignore?: RegExp[]): Promise; /** * --- 复制文件 --- * @param current 当前任务 id * @param src 源文件 * @param dest 目标文件 */ export declare function copyFile(current: lCore.TCurrent, src: string, dest: string): Promise; export interface IMountHandler { /** --- 挂载时间,无需设置 --- */ 'date'?: Date; getContent?: (path: string, options?: BufferEncoding | { 'encoding'?: BufferEncoding; 'start'?: number; 'end'?: number; 'progress'?: (loaded: number, total: number) => void | Promise; }) => Blob | string | null | Promise; putContent?: (path: string, data: string | Blob, options?: { 'encoding'?: BufferEncoding | null; 'mode'?: string | number; 'flag'?: string | number; }) => boolean | Promise; readLink?: (path: string, encoding?: BufferEncoding) => string | null | Promise; symlink?: (filePath: string, linkPath: string, type?: 'dir' | 'file' | 'junction') => boolean | Promise; unlink?: (path: string) => boolean | Promise; stats?: (path: string) => IStats | null | Promise; mkdir?: (path: string, mode?: number) => boolean | Promise; rmdir?: (path: string) => boolean | Promise; chmod?: (path: string, mod: string | number) => boolean | Promise; rename?: (oldPath: string, newPath: string) => boolean | Promise; readDir?: (path: string, encoding?: BufferEncoding) => IDirent[] | Promise; copyFile?: (src: string, dest: string) => boolean | Promise; } /** --- 文件/文件夹信息对象 --- */ export interface IStats { isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; 'size': number; 'blksize': number; 'atimeMs': number; 'mtimeMs': number; 'ctimeMs': number; 'birthtimeMs': number; 'atime': Date; 'mtime': Date; 'ctime': Date; 'birthtime': Date; } /** --- 目录下项目 --- */ export interface IDirent { isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; 'name': string; }