Compare commits

..

No commits in common. '8bf5d8b4d20fd97f8e4bc0042fb61537915884e6' and 'f4004c035d4ff53c1e74eff6525db83008251d70' have entirely different histories.

@ -34,15 +34,13 @@ function doRead(handle, length) {
return buffer;
} else if (result.bytesRead < length) {
// TODO: For possible future performance optimization, consider reusing the remaining Buffer allocation for a next read, if possible. Need more data on how often this case occurs first, though, to justify the added complexity.
return buffer.slice(0, result.bytesRead);
return buffer.slice(0, length);
} else {
throw new Error(`Read more bytes (${result.bytesRead}) than the specified 'length' (${length}); this should never happen!`);
}
});
}
// FIXME: This should probably *only* allow reading mode flags
module.exports = function createReadFileStream(_path, _options) {
let [ path, options ] = validateArguments(arguments, [
[ "path", required, isString ],
@ -56,9 +54,6 @@ module.exports = function createReadFileStream(_path, _options) {
let handlePromise = fs.open(path, options.flag, options.mode);
// Silence unhandled rejection warnings until later
handlePromise.catch(() => {});
// TODO: Metadata, including stream label and file size/type/path
return pipe([
simpleSource({

@ -1,6 +1,6 @@
{
"name": "@promistream/read-file",
"version": "0.1.1",
"version": "0.1.0",
"main": "index.js",
"keywords": [
"promistream"

Loading…
Cancel
Save