more-node-fs
Advanced tools
Comparing version 1.2.1 to 1.2.2
/// <reference types="node" /> | ||
import fs from 'fs'; | ||
interface PathOptions { | ||
export interface PathOptions { | ||
/** If specified, then will not look at paths that match this regex. */ | ||
@@ -16,7 +16,6 @@ ignore?: RegExp; | ||
} | ||
declare class ReaddirResult { | ||
export interface ReaddirResult { | ||
files: string[]; | ||
dirs: string[]; | ||
others: string[]; | ||
constructor(); | ||
} | ||
@@ -23,0 +22,0 @@ /** |
@@ -24,9 +24,2 @@ "use strict"; | ||
const rmdir = util_1.promisify(fs_1.default.rmdir); | ||
class ReaddirResult { | ||
constructor() { | ||
this.files = []; | ||
this.dirs = []; | ||
this.others = []; | ||
} | ||
} | ||
/** | ||
@@ -90,3 +83,3 @@ * Asyncronously loop through all paths found in or at the path parameter. This function is | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const result = new ReaddirResult(); | ||
const result = { files: [], dirs: [], others: [] }; | ||
yield forEachPath(path, (pathInFolder, stats) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -113,3 +106,3 @@ if (stats.isFile()) | ||
function readdirDeepSync(path, options = {}) { | ||
const result = new ReaddirResult(); | ||
const result = { files: [], dirs: [], others: [] }; | ||
for (const { stats, path: pathInFolder } of walkdir(path, options)) { | ||
@@ -116,0 +109,0 @@ if (stats.isFile()) |
{ | ||
"name": "more-node-fs", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A utility which adds some more File System functions for Node.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -28,3 +28,3 @@ | ||
forEachPathSync('./path/to/somewhere', (path, stats) => { | ||
if (stats.isFile() && /\.png$/i.test(path)) | ||
if (stats.isFile() && /\.png$/i.test(path)) | ||
images.push(path); | ||
@@ -35,4 +35,4 @@ }); | ||
const images2 = []; | ||
for (const { stats, path } of walkdir('./path/to/somewhere'), { search: 'dfs' }) { | ||
if (stats.isFile() && /\.png$/i.test(path)) | ||
for (const { path, stats } of walkdir('./path/to/somewhere'), { search: 'dfs' }) { | ||
if (stats.isFile() && /\.png$/i.test(path)) | ||
images2.push(path); | ||
@@ -39,0 +39,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26489
305