From 771539684f7781f08938cade9f3d329992478766 Mon Sep 17 00:00:00 2001 From: Felix Schlitter Date: Sun, 23 Nov 2014 12:33:28 +1300 Subject: [PATCH] Use `archive.bulk()` to avoid EMFILE errors As per the documentation, the `archive.bulk()` call promises to avoid EMFILE errors (too many open files). --- lib/utils.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 982259d25..15071b311 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -125,14 +125,20 @@ module.exports = { archive.on('error', reject); // Add the files - files.forEach(function (file) { + var filesBulk = []; + files.forEach(function(file){ if(file.dest === 'package.json' && platformSpecificManifest){ archive.append(platformSpecificManifest, {name: 'package.json'}); } - else { - archive.file(file.src, { name:file.dest }); + else + { + filesBulk.push({ + src: file.src, + data: { name: file.dest } + }); } - }); + }) + archive.bulk(filesBulk) // Some logs archive.on('entry', function (file) {