IModelJsFs Class

File system operations that are defined on all platforms. See also Platform and KnownLocations

Methods

Name Description
constructor(): IModelJsFs    
appendFileSync(pathname: string, str: string): void Static Append to a file.  
copySync(src: string, dest: string, opts?: any): void Static Make a copy of a file  
existsSync(pathname: string): boolean Static Does file or directory exist?  
lstatSync(pathname: string): undefined | IModelJsFsStats Static Get information about a file.  
mkdirSync(pathname: string): void Static Create a directory.  
purgeDirSync(dirPath: string): void Static Remove a directory, recursively  
readFileSync(pathname: string): string | Buffer Static Read file  
readdirSync(pathname: string): string[] Static Gets the file and directory names in the specified directory.  
recursiveFindSync(rootDir: string, pattern: RegExp): string[] Static Finds files recursively based on a pattern  
recursiveMkDirSync(dirPath: string): void Static Create a directory, recursively setting up the path as necessary  
removeSync(pathname: string): void Static Delete a file or remove a directory (rm -r).  
rmdirSync(pathname: string): void Static Remove a directory.  
unlinkSync(pathname: string): void Static Delete a file.  
walkDirSync(rootDir: string, cb: (pathname: string, isDir: boolean) => boolean): void Static Walks a directory in breadth first fashion  
writeFileSync(pathname: string, data: string | Uint8Array, wflag: string = "w"): void Static Write to a file.  

Defined in

Last Updated: 20 June, 2023