JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1934
  • Score
    100M100P100Q116507F
  • License

Read a glob of files, dynamically choosing the reader or requiring the files based on the file extension.

Package Exports

  • file-reader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (file-reader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

file-reader NPM version

Read a glob of files, dynamically choosing the reader or requiring the files based on the file extension.

Install with npm

npm i file-reader --save

Usage

Read a glob of files:

var read = require('file-reader');

read('*.js');
//=> { a: [Function: aaa], b: [Function: bbb], c: [Function: ccc] }

read('*.txt');
//=> { a: 'AAA', b: 'BBB', c: 'CCC' }

read('*.{yml,json}');
//=> { a: { a: 'a' }, b: { b: 'b' }, c: { c: 'c' } }

Read a single file (you must supply the full file path, no glob patterns):

var read = require('file-reader');

read.file('a.js');
//=> { a: [Function: foo] }

read.file('a.txt');
//=> { a: 'foo' }

read('a.yml');
//=> { a: { foo: 'bar' } }

Run tests

Install dev dependencies:

npm i -d && npm test

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on January 21, 2015.