Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using fs-read-queue to prevent ENFILE errors #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

var fs = require('fs')
, readFile = require('fs-read-queue')
, path = require('path')
, join = path.join
, resolve = path.resolve
Expand Down Expand Up @@ -93,7 +94,7 @@ function read(path, options, fn) {
if (cached) return fn(null, str);

// read
fs.readFile(path, 'utf8', function(err, str){
readFile(path, 'utf8', function(err, str){
if (err) return fn(err);
// remove extraneous utf8 BOM marker
str = str.replace(/^\uFEFF/, '');
Expand Down Expand Up @@ -236,7 +237,7 @@ exports.liquid.render = function(str, options, fn){
var extname = path.extname(name) || '.liquid';
var filename = path.join(includeDir, basename + extname);

fs.readFile(filename, {encoding: 'utf8'}, function (err, data){
readFile(filename, {encoding: 'utf8'}, function (err, data){
if (err) return callback(err);
callback(null, engine.parse(data));
});
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"test": "mocha"
},
"dependencies": {
"bluebird": "^2.9.26"
"bluebird": "^2.9.26",
"fs-read-queue": "^0.1.1"
}
}