smartfile/dist/smartfile.classes.smartfile.d.ts

78 lines
1.7 KiB
TypeScript
Raw Normal View History

/// <reference types="node" />
2017-05-07 21:00:56 +00:00
import * as plugins from './smartfile.plugins';
export interface ISmartfileConstructorOptions {
path?: string;
2017-04-29 15:20:09 +00:00
contentString?: string;
contentBuffer?: Buffer;
2017-04-30 16:13:17 +00:00
base?: string;
}
2017-04-27 14:48:08 +00:00
/**
* class Smartfile
* -> is vinyl file compatible
*/
export declare class Smartfile {
2017-04-27 14:48:08 +00:00
/**
* the full path of the file on disk
*/
path: string;
2017-05-07 21:00:56 +00:00
/**
*
*/
parsedPath: plugins.path.ParsedPath;
2017-04-29 15:20:09 +00:00
/**
* the content of the file as Buffer
*/
contentBuffer: Buffer;
2017-04-27 14:48:08 +00:00
/**
* The current working directory of the file
2017-05-07 21:00:56 +00:00
* Note:this is similar to gulp and different from native node path base
2017-04-27 14:48:08 +00:00
*/
2017-04-30 16:13:17 +00:00
base: string;
2017-04-27 14:48:08 +00:00
/**
* sync the file with disk
*/
sync: boolean;
/**
* the constructor of Smartfile
* @param optionsArg
*/
constructor(optionsArg: ISmartfileConstructorOptions);
/**
* set contents from string
* @param contentString
*/
2017-04-27 14:48:08 +00:00
setContentsFromString(contentString: string): void;
/**
* write file to disk
*/
write(): Promise<void>;
/**
* read file from disk
*/
read(): Promise<void>;
2017-04-30 16:13:17 +00:00
/**
* vinyl-compatibility: alias of this.contentBuffer
*/
contents: Buffer;
/**
* vinyl-compatibility
*/
readonly cwd: string;
/**
* return relative path of file
*/
readonly relative: string;
/**
* return truw when the file has content
*/
isNull(): boolean;
/**
* return true if contents are Buffer
*/
isBuffer(): boolean;
isDirectory(): boolean;
isStream(): boolean;
isSymbolic(): boolean;
2017-05-27 21:47:39 +00:00
updateFileName(fileNameArg: string): void;
}