Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
2fc132ab20 | |||
e948d08f2e |
12
dist/smartfile.fs.d.ts
vendored
12
dist/smartfile.fs.d.ts
vendored
@ -19,6 +19,14 @@ export declare let isDirectory: (pathArg: any) => boolean;
|
|||||||
* Checks if a given path points to an existing file
|
* Checks if a given path points to an existing file
|
||||||
*/
|
*/
|
||||||
export declare let isFile: (pathArg: any) => boolean;
|
export declare let isFile: (pathArg: any) => boolean;
|
||||||
|
/**
|
||||||
|
* ensures that a directory is in place
|
||||||
|
*/
|
||||||
|
export declare let ensureDir: (dirPathArg: string) => any;
|
||||||
|
/**
|
||||||
|
* ensures that a directory is in place
|
||||||
|
*/
|
||||||
|
export declare let ensureDirSync: (dirPathArg: string) => void;
|
||||||
/**
|
/**
|
||||||
* copies a file from A to B on the local disk
|
* copies a file from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
@ -70,9 +78,11 @@ export declare let toVinylSync: (filePathArg: any, options?: {}) => any;
|
|||||||
export declare let requireReload: (path: string) => any;
|
export declare let requireReload: (path: string) => any;
|
||||||
/**
|
/**
|
||||||
* lists Folders in a directory on local disk
|
* lists Folders in a directory on local disk
|
||||||
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
export declare let listFolders: (pathArg: string) => any;
|
export declare let listFolders: (pathArg: string) => any;
|
||||||
/**
|
/**
|
||||||
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
||||||
|
* @returns an array with the folder names as strings
|
||||||
*/
|
*/
|
||||||
export declare let listFoldersSync: (pathArg: any) => any;
|
export declare let listFoldersSync: (pathArg: any) => string[];
|
||||||
|
18
dist/smartfile.fs.js
vendored
18
dist/smartfile.fs.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "smartfile",
|
"name": "smartfile",
|
||||||
"version": "4.0.5",
|
"version": "4.0.6",
|
||||||
"description": "offers smart ways to work with files in nodejs",
|
"description": "offers smart ways to work with files in nodejs",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -55,6 +55,22 @@ export let isFile = function(pathArg):boolean{
|
|||||||
============================ FS ACTIONS =========================
|
============================ FS ACTIONS =========================
|
||||||
===============================================================*/
|
===============================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ensures that a directory is in place
|
||||||
|
*/
|
||||||
|
export let ensureDir = (dirPathArg:string) => {
|
||||||
|
let done = plugins.q.defer();
|
||||||
|
plugins.fs.ensureDir(dirPathArg,done.resolve);
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ensures that a directory is in place
|
||||||
|
*/
|
||||||
|
export let ensureDirSync = (dirPathArg:string) => {
|
||||||
|
plugins.fs.ensureDirSync(dirPathArg);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* copies a file from A to B on the local disk
|
* copies a file from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
@ -157,6 +173,7 @@ export let requireReload = function(path:string){
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* lists Folders in a directory on local disk
|
* lists Folders in a directory on local disk
|
||||||
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
export let listFolders = function(pathArg:string){
|
export let listFolders = function(pathArg:string){
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
@ -169,8 +186,9 @@ export let listFolders = function(pathArg:string){
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
||||||
|
* @returns an array with the folder names as strings
|
||||||
*/
|
*/
|
||||||
export let listFoldersSync = function(pathArg){
|
export let listFoldersSync = function(pathArg):string[]{
|
||||||
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
||||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user