Repository navigation
fix: follow-ups to #437 parseBuffer fix: - #438
Merged
Merged
Conversation
- parseBuffer: accept any non-empty ArrayBufferView, including DataView,
which the old check rejected. Inputs that are not views still throw.
- loadPDF/parseBuffer: use so verbosity 0 (ERRORS)
is honored instead of falling back to WARNINGS.
- Stream: check explicitly, so a sub-stream at
offset 0 with length 0 is empty instead of the whole buffer.
- Field tab indexes (TI): number them per document, from 0, in page
order. The counter was shared by the whole process, so TI depended on
how many documents had been parsed before, including concurrently.
- types: parseBuffer(pdfBuffer: ArrayBufferView) in .d.ts and .d.cts,
matching the typed-array support the implementation already had.
- JSDoc: parseBuffer and #startParsingPDF describe the accepted inputs
and the throw.
Tests:
- _test_parseBuffer_offset: add a DataView case; force Buffer.from to
use the shared pool at a non-zero offset (before, the test passed even
with the bug on Node 22's 8 KiB pool); compare full output now that TI
is deterministic; the helper uses once() and always calls destroy();
add unit tests for Stream sub-streams against base/core/stream.js.
- _test_errors: inputs that are not views and an empty DataView throw;
verbosity 0 hides engine warnings for both parseBuffer and loadPDF.
- _test_testMultipleDataPDF: TI starts at 0 for repeated, same-parser
and concurrent parses.
Docs: README API reference documents parseBuffer inputs, the
verbosity levels and how TI is numbered; unit suite counts updated.
Behavior change: when several PDFs are parsed in one process (e.g. the
CLI on a directory), TI now starts at 0 for each file instead of
continuing from the previous one. Corpus check: across 1064 test:forms
output files, the only differences from master are TI values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests:
Docs: README API reference documents parseBuffer inputs, the
verbosity levels and how TI is numbered; unit suite counts updated.
Behavior change: when several PDFs are parsed in one process (e.g. the
CLI on a directory), TI now starts at 0 for each file instead of
continuing from the previous one. Corpus check: across 1064 test:forms
output files, the only differences from master are TI values.