2017-03-04 20:10:46 +00:00
|
|
|
/// <reference types="node" />
|
2017-05-07 21:00:56 +00:00
|
|
|
import * as plugins from './smartfile.plugins';
|
2017-03-04 20:10:46 +00:00
|
|
|
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-30 16:13:17 +00:00
|
|
|
base?: string;
|
2017-03-04 20:10:46 +00:00
|
|
|
}
|
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-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
|
|
|
|
*/
|
2017-03-04 20:10:46 +00:00
|
|
|
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;
|
2017-05-01 20:07:25 +00:00
|
|
|
isSymbolic(): boolean;
|
2017-05-27 21:47:39 +00:00
|
|
|
updateFileName(fileNameArg: string): void;
|
2016-05-19 22:31:53 +00:00
|
|
|
}
|