/// /// import type { Writable } from 'stream'; import type { Arguments, Table } from '@kui-shell/core'; import type { FStat } from '../lib/fstat'; import type { KuiGlobOptions, GlobStats } from '../lib/glob'; type DirEntry = GlobStats; export { DirEntry }; /** * A Virtual File System implements `ls`, `cp`, etc. Filesystem * operations against filepaths that match this `mountPath` as a * prefix will be delegated to this `VFS` impl. * */ export default interface VFS { /** Path to mount point */ mountPath: string; /** Is this a local mount? */ isLocal: boolean; /** Is this a virtual mount? i.e. one that works in a browser without server-side proxy support */ isVirtual: boolean; /** Any tags that the provider might want to associate with their VFS */ tags?: string[]; /** Directory listing */ ls(opts: Pick, 'tab' | 'REPL' | 'parsedOptions'>, filepaths: string[]): DirEntry[] | Promise; /** Insert filepath into directory */ cp(opts: Pick, srcFilepaths: string[], dstFilepath: string, srcIsSelf: boolean[], dstIsSelf: boolean, srcProvider: VFS[], dstProvider: VFS): Promise; /** Remove filepath */ rm(opts: Pick, filepath: string, recursive?: boolean): Promise; /** Fetch contents */ fstat(opts: Pick, filepath: string, withData?: boolean, enoentOk?: boolean): Promise; /** Fetch content slice */ fslice(filename: string, offset: number, length: number): Promise; /** Pipe a content slice to the given `stream` */ pipe?: (filename: string, offset: number, length: number, stream: Writable) => Promise; /** write data to file */ fwrite(opts: Pick, fullpath: string, data: string | Buffer, options?: { append?: boolean; }): Promise; /** Create a directory/bucket */ mkdir(opts: Pick, filepath: string): Promise; /** remove a directory/bucket */ rmdir(opts: Pick, filepath: string): Promise; }