@gideo-llc/backblaze-b2-upload-any
Version:
An intelligent upload function to be used with the backblaze-b2 module
17 lines (13 loc) • 387 B
JavaScript
const stream = require('stream');
// Simple readable stream that provides an array of buffers as a stream.
module.exports = buffers => {
let i = 0;
return new stream.Readable({
read(size) {
while (i < buffers.length && this.push(buffers[i++])) { }
if (i >= buffers.length) {
this.push(null);
}
},
});
};