Load text files, optionally referencing other text files.
Combined with async/await, this makes it very easy to access externalize text resources.
$ npm install file-repo --save
// Load the module (import style)
import FileRepo from 'file-repo';
// Load the module (require style)
const FileRepo = require('file-repo').default;
// Create a repo
const repo = new FileRepo({
baseDir: path.join(__dirname, 'sql'),
suffix: 'sql',
cache: true,
});
// Load sql/foo/my-query.sql
const sql = await repo.load('foo/my-query');
None!
- Natively promisified for easy async/await integration
- Supports nested relative pathed references via ${path/to/reference}
- Supports caching of loaded files so only read from disk once
To build the module run:
$ make
Then, to run the tests run:
$ make test
ISC. See the file LICENSE.