file-repo
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

file-repo

NPM

Build Status

Overview

Load text files, optionally referencing other text files.

Combined with async/await, this makes it very easy to access externalize text resources.

Install

$ npm install file-repo --save

Usage

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

Dependencies

None!

Features

  • 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

Building and Testing

To build the module run:

$ make

Then, to run the tests run:

$ make test

License

ISC. See the file LICENSE.

Readme

Keywords

Package Sidebar

Install

npm i file-repo

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • sehrope