Sha256: 70a998ce6b3da13e242332e704d9b64ee88c23520ee260663d178206a57ae14d
Contents?: true
Size: 556 Bytes
Versions: 26
Compression:
Stored size: 556 Bytes
Contents
import { join, resolve } from 'path'; import { readdir, stat } from 'fs'; import { promisify } from 'util'; const toStats = promisify(stat); const toRead = promisify(readdir); export async function totalist(dir, callback, pre='') { dir = resolve('.', dir); await toRead(dir).then(arr => { return Promise.all( arr.map(str => { let abs = join(dir, str); return toStats(abs).then(stats => { return stats.isDirectory() ? totalist(abs, callback, join(pre, str)) : callback(join(pre, str), abs, stats) }); }) ); }); }
Version data entries
26 entries across 26 versions & 1 rubygems