fs-from-object
⚡️ Create files and folders in the filesystem directly from an object.
const fsFromObject = const tree = name: 'index.txt' mtime: '07/07/2016' contents: 'Hello World!' name: 'folder' contents: name: 'one.txt' contents: 'Hello World!' name: 'empty.txt'
Installation
> npm install fs-from-object
API
fsFromObject(path: String, tree: Object)
Creates the given tree
representation at path
.
Tree Nodes
Each node can have the following properties:
- name: Name of the file or folder
- contents: File or folder contents (optional)
- mtime: Modified time of a file or directory (optional)
ephemeralFsFromObject(tree: Object, task: Function<Promise>)
Creates an ephemeral path with the given tree
in it. As soon as task
resolves, the folder will get deleted.
The ephemeral path has the following signature:
`/`
Example