node-dir-to-obj
v0.2.0
Published
Convert the contents of a directory to an object.
Downloads
10
Readme
node-dir-to-obj
Convert the contents of a directory to an object.
Installation
npm i node-dir-to-obj
Usage
Suppose a directory structure like this:
a.txt
subDir
-- b.txt
import dirToObj from 'node-dir-to-obj';
const obj = await dirToObj('<dir path>');
/*
{
'a.txt': '<contents of a.txt>',
sub: {
'b.txt': '<contents of a.txt>',
},
}
*/
Options
ignoreMap
a set of names that should be ignored.textMode
dumps file contents as text instead of hex.