|
|
@ -3,6 +3,7 @@
|
|
|
|
const Promise = require("bluebird");
|
|
|
|
const Promise = require("bluebird");
|
|
|
|
const propagateAbort = require("@promistream/propagate-abort");
|
|
|
|
const propagateAbort = require("@promistream/propagate-abort");
|
|
|
|
const unreachable = require("@joepie91/unreachable")("@promistream/buffer");
|
|
|
|
const unreachable = require("@joepie91/unreachable")("@promistream/buffer");
|
|
|
|
|
|
|
|
const util = require("util");
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function bufferStream() {
|
|
|
|
module.exports = function bufferStream() {
|
|
|
|
let buffer;
|
|
|
|
let buffer;
|
|
|
@ -20,7 +21,11 @@ module.exports = function bufferStream() {
|
|
|
|
return attemptRead(readFunc);
|
|
|
|
return attemptRead(readFunc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw new Error("Buffered stream produced a non-array value");
|
|
|
|
// FIXME: Make this its own module, and improve its compactness?
|
|
|
|
|
|
|
|
let stringified = util.inspect(result, { depth: 0 })
|
|
|
|
|
|
|
|
.replace(/\s+/g, " ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw new Error(`Buffered stream produced a non-array value: ${stringified}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|