build-file-tree-from-object
Asynchronously build directories and write files from an object.
Install
npm install build-file-tree-from-object
Usage
const build = require('build-file-tree-from-object')
const tree = {
'some.file': 'string value means:\n file content\n',
'file.dat' : Buffer.from('Buffer value also means:\n file content\n'),
'some_dir' : {
'sub.file': 'another file\ninside the new dir\n',
'dirdir': {
'itty.bitty.file': 'itty bitty'
},
'dir2': {
},
'empty.file': '',
},
}
build({
tree,
done: error => {
},
})
build({
tree,
root: 'some/dir',
done: error => { }
})
build({
tree,
error: error => {
},
done: error => { }
})