README
fx45-node
Generate JSON files for fx54-node.
The packages names may be slightly confusing:
fx54-node
Verify the existence or content of files in a hierarchical object.fx45-node
Generate JSON files for fx54-node.
Installation
yarn add fx45-node
Run tests
yarn test
Example
Assume a directory with following structure:
- root
- dir1
a.txt
- dir2
b.txt
Code:
import objectFromDirectory from 'fx45-node';
// or Node.js style: const objectFromDirectory = require('fx45-node').default;
console.log(JSON.stringify(objectFromDirectory('./root')));
Output:
{
"dir1": {
"a.txt": "Contents of a.txt"
},
"dir2": {
"b.txt": "Contents of b.txt"
}
}
API
import objectFromDirectory from 'fx45-node';
objectFromDirectory(directory: string, ignoredFiles: string[]|null = null): object|null
ignoredFiles
files to be ignored, e.g.['.DS_Store', 'thumbs.db']
.