Files
Foundry-VTT-Docker/resources/app/node_modules/unzipper/lib/BufferStream.js

20 lines
455 B
JavaScript
Raw Normal View History

2025-01-04 00:34:03 +01:00
const Stream = require('stream');
module.exports = function(entry) {
return new Promise(function(resolve, reject) {
const chunks = [];
const bufferStream = Stream.Transform()
.on('finish', function() {
resolve(Buffer.concat(chunks));
})
.on('error', reject);
bufferStream._transform = function(d, e, cb) {
chunks.push(d);
cb();
};
entry.on('error', reject)
.pipe(bufferStream);
});
};