Skip to content

Fix and test handling of partially-read objects - #69

Open
twiss wants to merge 1 commit into
mainfrom
handle-partially-read-objects
Open

Fix and test handling of partially-read objects#69
twiss wants to merge 1 commit into
mainfrom
handle-partially-read-objects

Conversation

@twiss

@twiss twiss commented Nov 6, 2025

Copy link
Copy Markdown
Member

In slice, transform[Async] and readToEnd, properly handle (non-)stream objects that were partially read (e.g. peeked at) before.

Also, add tests of the various cases.

@twiss
twiss requested a review from larabr November 6, 2025 16:12
In `slice`, `transform[Async]` and `readToEnd`, properly handle
(non-)stream objects that were partially read (e.g. peeked at)
before.

Also, add tests of the various cases.
@twiss
twiss force-pushed the handle-partially-read-objects branch from 0cab127 to 6519b87 Compare November 6, 2025 16:13
@larabr
larabr force-pushed the main branch 2 times, most recently from d0f6ef9 to d8efe87 Compare November 13, 2025 13:10
Comment thread lib/writer.js
ArrayStream.prototype.readToEnd = async function(join) {
await this[doneWritingPromise];
const result = join(this.slice(this[readingIndex]));
const result = join((this[externalBuffer] || []).concat(this.slice(this[readingIndex])));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stale externalBuffer content is returned on repeated readToEnd calls I think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants