Skip to content

Instantly share code, notes, and snippets.

@retorquere
Created April 4, 2021 22:33
Show Gist options
  • Save retorquere/5c554ac33e0bf2b5c92c755b63bf5542 to your computer and use it in GitHub Desktop.
Save retorquere/5c554ac33e0bf2b5c92c755b63bf5542 to your computer and use it in GitHub Desktop.
declare interface DirectoryIterator {
forEach: (handler: any) => Promise<void>
}
declare interface DirectoryIteratorConstructable {
new(path: string): DirectoryIterator
}
export declare const OS: {
File: {
exists: (path: string) => Promise<boolean>
read: (path: string, options: { encoding: string } ) => Promise<string>
move: (from: string, to: string) => Promise<void>
remove: (path: string, options?: { ignoreAbsent: boolean }) => Promise<void>
writeAtomic: (path: string, data: string, options: { tmpPath: string, encoding: string }) => Promise<void>
makeDir: (path: string, options: { ignoreExisting: boolean }) => Promise<void>
stat: (path: string) => { isDir: boolean, size: number, unixMode?: number }
DirectoryIterator: DirectoryIteratorConstructable
}
Path: {
join: (...args: string[]) => string
dirname: (path: string) => string
basename: (path: string) => string
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment