directory-as-object

1.0.2 • Public • Published

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'));;

Package Sidebar

Install

npm i directory-as-object

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

5.51 kB

Total Files

4

Last publish

Collaborators

  • drmegavolt