115 lines
2.8 KiB
TypeScript
115 lines
2.8 KiB
TypeScript
import Immutable from "immutable";
|
|
import File from "./file";
|
|
import Promise from "../utils/promise";
|
|
declare const FS_base: Immutable.Record.Class;
|
|
declare class FS extends FS_base {
|
|
/**
|
|
Return path to the root
|
|
|
|
@return {string}
|
|
*/
|
|
getRoot(): string;
|
|
/**
|
|
Verify that a file is in the fs scope
|
|
|
|
@param {string} filename
|
|
@return {boolean}
|
|
*/
|
|
isInScope(filename: string): boolean;
|
|
/**
|
|
Resolve a file in this FS
|
|
@return {string}
|
|
*/
|
|
resolve(...args: string[]): string;
|
|
/**
|
|
Check if a file exists, run a Promise(true) if that's the case, Promise(false) otherwise
|
|
|
|
@param {string} filename
|
|
@return {Promise<Boolean>}
|
|
*/
|
|
exists(filename: string): Promise<boolean>;
|
|
/**
|
|
Read a file and returns a promise with the content as a buffer
|
|
|
|
@param {string} filename
|
|
@return {Promise<Buffer>}
|
|
*/
|
|
read(filename: string): Promise<Buffer>;
|
|
/**
|
|
Read a file as a string (utf-8)
|
|
@return {Promise<String>}
|
|
*/
|
|
readAsString(filename: string, encoding?: string): Promise<string>;
|
|
/**
|
|
Read file as a stream
|
|
|
|
@param {string} filename
|
|
@return {Promise<Stream>}
|
|
*/
|
|
readAsStream(filename: string): any;
|
|
/**
|
|
Read stat infos about a file
|
|
|
|
@param {string} filename
|
|
@return {Promise<File>}
|
|
*/
|
|
statFile(filename: string): Promise<File>;
|
|
/**
|
|
List files/directories in a directory.
|
|
Directories ends with '/'
|
|
|
|
@param {string} dirname
|
|
@return {Promise<List<String>>}
|
|
*/
|
|
readDir(dirname: string): any;
|
|
/**
|
|
List only files in a diretcory
|
|
Directories ends with '/'
|
|
|
|
@param {string} dirname
|
|
@return {Promise<List<String>>}
|
|
*/
|
|
listFiles(dirname: string): any;
|
|
/**
|
|
List all files in a directory
|
|
|
|
@param {string} dirName
|
|
@param {Function(dirName)} filterFn: call it for each file/directory to test if it should stop iterating
|
|
@return {Promise<List<String>>}
|
|
*/
|
|
listAllFiles(dirName: string, filterFn: (arg0: string) => boolean): any;
|
|
/**
|
|
Find a file in a folder (case insensitive)
|
|
Return the found filename
|
|
|
|
@param {string} dirname
|
|
@param {string} filename
|
|
@return {Promise<String>}
|
|
*/
|
|
findFile(dirname: string, filename: string): any;
|
|
/**
|
|
Load a JSON file
|
|
By default, fs only supports JSON
|
|
|
|
@param {string} filename
|
|
@return {Promise<Object>}
|
|
*/
|
|
loadAsObject(filename: string): any;
|
|
/**
|
|
Create a FS instance
|
|
|
|
@param {Object} def
|
|
@return {FS}
|
|
*/
|
|
static create(def: any): FS;
|
|
/**
|
|
Create a new FS instance with a reduced scope
|
|
|
|
@param {FS} fs
|
|
@param {string} scope
|
|
@return {FS}
|
|
*/
|
|
static reduceScope(fs: FS, scope: string): FS;
|
|
}
|
|
export default FS;
|
|
//# sourceMappingURL=fs.d.ts.map
|