Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(csv-generate): preserve object-mode records in Web Streams - #576

Open
anlonely wants to merge 1 commit into
adaltas:masterfrom
anlonely:fix/web-stream-object-records
Open

anlonely wants to merge 1 commit into
adaltas:masterfrom
anlonely:fix/web-stream-object-records

Conversation

@anlonely

@anlonely anlonely commented Dec 5, 2026

Copy link
Copy Markdown

The Web Streams adapter for csv-generate/stream passed every chunk through Buffer.from(). In object mode the chunk is an array of fields. For a row ['Alice', '007', 300], getReader().read() returned <Buffer 00 07 2c>, losing the name, the leading zeros and most of the numeric value.

The adapter now enqueues the original row when object mode is enabled. Text mode continues to emit CSV buffers. The TypeScript overloads cover objectMode, its object_mode alias, and options whose mode is only known at runtime. The reader regression asserts the actual contents of two records. The previous test destructured record from the reader result and only checked how many entries it pushed.

Verification

  • Confirmed the new object-mode assertion fails on c72cc6c, then passes after the change. Compared the public ESM stream with the synchronous API for 15 combinations including zero and 1,025 records. Verified both mode spellings and byte output in a fresh CommonJS build.
  • Node 24.23.0: the full workspace test run completed across 14 projects (1,119 passing, 5 pending). Workspace lint reported no errors. Checked formatting and git diff --check.

Prepared and tested with OpenAI Codex on behalf of @anlonely.

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.

1 participant