Skip to content

Fix for the 'start' range of BlobDataItem when reading its stream #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion from.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down