diff --git a/from.js b/from.js index 546edfa..bdca282 100644 --- a/from.js +++ b/from.js @@ -23,7 +23,7 @@ class BlobDataItem { constructor(options) { this.size = options.size; this.path = options.path; - this.start = options.start; + this.start = options.start || 0; this.mtime = options.mtime; } diff --git a/test.js b/test.js index b6cf1a8..a38c8fe 100644 --- a/test.js +++ b/test.js @@ -163,6 +163,15 @@ test('Reading after modified should fail', async t => { t.is(error.name, 'NotReadableError'); }); +test('Reading from the stream created by blobFrom', async t => { + const blob = blobFrom('./LICENSE'); + const expected = await fs.promises.readFile('./LICENSE', 'utf-8'); + + const actual = await getStream(blob.stream()); + + t.is(actual, expected); +}); + test('Blob-ish class is an instance of Blob', t => { class File { stream() {}