Skip to content

Commit 483973c

Browse files
authored
Fix for the 'start' range of BlobDataItem when reading its stream (#85)
Set default value for 'start' option
1 parent cc929f3 commit 483973c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

from.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BlobDataItem {
2323
constructor(options) {
2424
this.size = options.size;
2525
this.path = options.path;
26-
this.start = options.start;
26+
this.start = options.start || 0;
2727
this.mtime = options.mtime;
2828
}
2929

test.js

+9
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ test('Reading after modified should fail', async t => {
163163
t.is(error.name, 'NotReadableError');
164164
});
165165

166+
test('Reading from the stream created by blobFrom', async t => {
167+
const blob = blobFrom('./LICENSE');
168+
const expected = await fs.promises.readFile('./LICENSE', 'utf-8');
169+
170+
const actual = await getStream(blob.stream());
171+
172+
t.is(actual, expected);
173+
});
174+
166175
test('Blob-ish class is an instance of Blob', t => {
167176
class File {
168177
stream() {}

0 commit comments

Comments
 (0)