0.0.4 • Published 6 years ago
rx-readdir v0.0.4
rx-readdir
reactive version of readdir with recursive directory scanning
This rxjs module returns an Observable which scans a specified folder recursively and optionally can exclude any sub-folders from scanning and outputs the file-/directory objects as javascript objects.
Usage
const { readdir$ } = require ('rx-readdir')
readdir$ ('.', ['node_modules'])
.subscribe ({
next: obj => {
console.log (obj)
}
})
outputs
{
type: "File", // Either "Directory" or "File"
name: "filename", // Filename without the extension
ext: ".txt", // Extension of the file, including the period
dir: "/path", // Directory in which the file/directory was found
fullPath: "/path/filename.txt", // Full path (+ filename) of file/directory
ctime: 2018-10-16T08:00:00.000Z, // Create timestamp
mtime: 2018-10-16T08:00:00.000Z, // Last modified timestamp
atime: 2018-10-16T08:00:00.000Z, // Last accessed timestamp
}
Install
With npm installed, run
$ npm install rx-readdir
Acknowledgments
rx-readdir was inspired by dir-analyzer and made possible with the rxjs, the Reactive Extensions For JavaScript
License
ISC