fs-read-queue

0.1.1 • Public • Published

fs-read-queue NPM version Build Status

Queue fs.readFile calls to the same file path.

The code in this module is inspired by the work done by mhiguera in this pull request.

Install with npm

$ npm i fs-read-queue --save

Usage

var readFile = require('fs-read-queue');

API

readFile

File reading function that will queue up calls to fs.readFile for the same filepath to prevent ENFILE errors.

Params

  • fp {String}: File path to read
  • options {String}: Additional options to pass to fs.readFile
  • cb {Function}: Callback function that takes err and contents parameters. Will be called when the file is read.

Example

readFile('path/to/my/file', function (err, contents) {
  if (err) return console.error(err);
  console.log(contents);
});

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Brian Woodward

License

Copyright © 2015 Brian Woodward Released under the MIT license.


This file was generated by verb-cli on July 01, 2015.

Readme

Keywords

none

Package Sidebar

Install

npm i fs-read-queue

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • doowb