directory-as-object
v1.0.2
Published
Serialize\Deserialize directory with files as JS object
Downloads
18
Readme
Directory As Object
This package can serialize and deserialize directory with files into\from JS object
- It scans directory recursively
- It can update existing files. Including deleting those that have correstponding property set to
null
Usage
Reading from directory
const dirAsObject = new DirectoryAsObject({rootPath: '/some/path'});
dirAsObject.serialize().then(files=> console.log(files));
Writing to directory
const dirAsObject = new DirectoryAsObject({rootPath: '/some/path'});
dirAsObject.deserialize({'test.js':'//hello'}).then(()=> console.log('Done'));;
Deleting files
The following code will delete /some/path/test.js
const dirAsObject = new DirectoryAsObject({rootPath: '/some/path'});
dirAsObject.deserialize({'test.js': null}).then(()=> console.log('Done'));;