From 86fffc8b4308b284d023530ce44d6126d8662ab4 Mon Sep 17 00:00:00 2001 From: Chris Talkington Date: Sat, 9 Mar 2024 19:44:33 -0600 Subject: [PATCH 1/3] add test for stream-like sources --- test/pack.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/pack.js b/test/pack.js index f7b9030b..913e545c 100644 --- a/test/pack.js +++ b/test/pack.js @@ -3,6 +3,7 @@ var fs = require('fs'); var assert = require('chai').assert; var mkdir = require('mkdirp'); +var Readable = require('readable-stream').Readable: var helpers = require('./helpers'); var binaryBuffer = helpers.binaryBuffer; @@ -55,6 +56,20 @@ describe('pack', function() { archive.finalize(); }); + it('should append Stream-like sources', function(done) { + var archive = new Packer(); + var testStream = fs.createWriteStream('tmp/stream-like.zip'); + + testStream.on('close', function() { + done(); + }); + + archive.pipe(testStream); + + archive.entry(Readable.from(['test'], { name: 'stream-like.txt', date: testDate }); + archive.finalize(); + }); + it('should append multiple sources', function(done) { var archive = new Packer(); From 58ff2a941a347acb53fc881476b1c50ef3ae98b1 Mon Sep 17 00:00:00 2001 From: Chris Talkington Date: Sat, 9 Mar 2024 19:45:38 -0600 Subject: [PATCH 2/3] Update pack.js --- test/pack.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pack.js b/test/pack.js index 913e545c..8dcee837 100644 --- a/test/pack.js +++ b/test/pack.js @@ -3,7 +3,7 @@ var fs = require('fs'); var assert = require('chai').assert; var mkdir = require('mkdirp'); -var Readable = require('readable-stream').Readable: +var Readable = require('readable-stream').Readable; var helpers = require('./helpers'); var binaryBuffer = helpers.binaryBuffer; From c3ae50aff25e62d240b9cd02ac6e77a81e649de2 Mon Sep 17 00:00:00 2001 From: Chris Talkington Date: Sat, 9 Mar 2024 19:47:28 -0600 Subject: [PATCH 3/3] Update pack.js --- test/pack.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pack.js b/test/pack.js index 8dcee837..ded0e5b6 100644 --- a/test/pack.js +++ b/test/pack.js @@ -66,7 +66,7 @@ describe('pack', function() { archive.pipe(testStream); - archive.entry(Readable.from(['test'], { name: 'stream-like.txt', date: testDate }); + archive.entry(Readable.from(['test']), { name: 'stream-like.txt', date: testDate }); archive.finalize(); });