2017-03-04 20:10:46 +00:00
|
|
|
/// <reference types="node" />
|
|
|
|
export interface ISmartfileConstructorOptions {
|
|
|
|
path?: string;
|
2017-04-29 15:20:09 +00:00
|
|
|
contentString?: string;
|
2017-03-04 20:10:46 +00:00
|
|
|
contentBuffer?: Buffer;
|
|
|
|
}
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
|
|
|
* class Smartfile
|
|
|
|
* -> is vinyl file compatible
|
|
|
|
*/
|
2016-05-19 22:31:53 +00:00
|
|
|
export declare class Smartfile {
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
|
|
|
* the full path of the file on disk
|
|
|
|
*/
|
2017-03-04 20:10:46 +00:00
|
|
|
path: string;
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
2017-04-29 15:20:09 +00:00
|
|
|
* gulp-compatibility: alias of this.contentBuffer
|
2017-04-27 14:48:08 +00:00
|
|
|
*/
|
2017-03-04 20:10:46 +00:00
|
|
|
contents: Buffer;
|
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
|
|
|
|
*/
|
|
|
|
cwd: string;
|
|
|
|
/**
|
|
|
|
* sync the file with disk
|
|
|
|
*/
|
|
|
|
sync: boolean;
|
|
|
|
/**
|
|
|
|
* the constructor of Smartfile
|
|
|
|
* @param optionsArg
|
|
|
|
*/
|
2017-03-04 20:10:46 +00:00
|
|
|
constructor(optionsArg: ISmartfileConstructorOptions);
|
2017-04-27 14:48:08 +00:00
|
|
|
/**
|
|
|
|
* return relative path of file
|
|
|
|
* ->
|
|
|
|
*/
|
|
|
|
readonly relative: string;
|
2017-03-04 20:10:46 +00:00
|
|
|
/**
|
|
|
|
* 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>;
|
2016-05-19 22:31:53 +00:00
|
|
|
}
|