add ensureEmptyDir() and ensureEmptyDirSync()

This commit is contained in:
2017-01-01 02:45:53 +01:00
parent 395504127c
commit 3e1101c5e1
12 changed files with 146 additions and 84 deletions

View File

@ -37,6 +37,16 @@ export declare let ensureDir: (dirPathArg: string) => plugins.q.Promise<{}>;
* ensures that a directory is in place
*/
export declare let ensureDirSync: (dirPathArg: string) => void;
/**
* ensure an empty directory
* @executes ASYNC
*/
export declare let ensureEmptyDir: (dirPathArg: string) => plugins.q.Promise<{}>;
/**
* ensure an empty directory
* @executes SYNC
*/
export declare let ensureEmptyDirSync: (dirPathArg: string) => void;
/**
* ensures that a file is on disk
* @param filePath the filePath to ensureDir
@ -81,7 +91,7 @@ export declare let toObjectSync: (filePathArg: any, fileTypeArg?: any) => any;
* @param filePath
* @returns {string|Buffer|any}
*/
export declare let toStringSync: (filePath: any) => string;
export declare let toStringSync: (filePath: any) => any;
/**
*
* @param filePathArg

21
dist/smartfile.fs.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,12 @@
/// <reference types="vinyl" />
/// <reference types="node" />
/// <reference types="q" />
import 'typings-global';
import plugins = require('./smartfile.plugins');
export interface vinyl {
contents: Buffer;
base: string;
path: string;
}
/**
* allows you to create a gulp stream
* from String, from an Array of Strings, from Vinyl File, from an Array of VinylFiles
@ -9,7 +14,7 @@ import plugins = require('./smartfile.plugins');
* @returns stream.Readable
* @TODO: make it async;
*/
export declare let toGulpStream: (fileArg: string | string[] | plugins.vinyl | plugins.vinyl[], baseArg?: string) => any;
export declare let toGulpStream: (fileArg: string | string[] | vinyl | vinyl[], baseArg?: string) => any;
/**
* converts file to Object
* @param fileStringArg
@ -26,7 +31,7 @@ export declare let toVinylFileSync: (fileArg: string, optionsArg?: {
filename?: string;
base?: string;
relPath?: string;
}) => plugins.vinyl;
}) => any;
/**
* takes a string array and some options and returns a vinylfile array
* @param arrayArg
@ -36,16 +41,16 @@ export declare let toVinylArraySync: (arrayArg: string[], optionsArg?: {
filename?: string;
base?: string;
relPath?: string;
}) => plugins.vinyl[];
}) => any[];
/**
* takes a vinylFile object and converts it to String
*/
export declare let toStringSync: (fileArg: plugins.vinyl) => any;
export declare let vinylToStringSync: (fileArg: vinyl) => string;
/**
* writes string or vinyl file to disk.
* @param fileArg
* @param fileNameArg
* @param fileBaseArg
*/
export declare let toFs: (fileContentArg: string | plugins.vinyl, filePathArg: any) => plugins.q.Promise<{}>;
export declare let toFs: (fileContentArg: string | vinyl, filePathArg: any) => plugins.q.Promise<{}>;
export declare let toFsSync: (fileArg: any, filePathArg: string) => void;

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,5 @@ export import q = require('q');
export declare let request: any;
export declare let requireReload: any;
export import smartpath = require('smartpath');
export import vinyl = require('vinyl');
export declare let vinylFile: any;
export declare let yaml: any;

View File

@ -9,7 +9,6 @@ exports.q = require("q");
exports.request = require('request');
exports.requireReload = require('require-reload');
exports.smartpath = require("smartpath");
exports.vinyl = require("vinyl");
exports.vinylFile = require('vinyl-file');
exports.yaml = require('js-yaml');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGZpbGUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLHlDQUE4QztBQUM5QywyQkFBZ0M7QUFDaEMsc0NBQTJDO0FBQ2hDLFFBQUEsSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQUNqQywrQkFBb0M7QUFDcEMseUJBQThCO0FBQ25CLFFBQUEsT0FBTyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQTtBQUM1QixRQUFBLGFBQWEsR0FBRyxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBQTtBQUNwRCx5Q0FBOEM7QUFDOUMsaUNBQXNDO0F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