-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Handle very small pdf's #580
Conversation
Hey @sindresorhus would appreciate a review on this when you get a chance. Thanks! |
I rerequested review and github seemed to automatically remove @Borewit. Not sure why! |
throw errors lint lint simplify wrap all AI reads in try catch move only ingore to try catch, early return pdf Revert "move only ingore to try catch, early return pdf" This reverts commit 3b90419.
5f1435e
to
c10a194
Compare
const buffer = Buffer.alloc(Math.min(maxBufferSize, tokenizer.fileInfo.size)); | ||
await tokenizer.readBuffer(buffer, {mayBeLess: true}); | ||
try { | ||
await tokenizer.ignore(1350); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This remains a sensitive point, but is not introduced by this PR.
Maybe we should drop support for specialized PDF formats as text based formats are out of scope.
Handle tiny pdf's, and add a test pdf < 1350 bytes (the test pdf is MIT licensed and from https://brendanzagaeski.appspot.com/0004.html)
just fyi generating an empty pdf from google drive results in a pdf of similar size (~700 bytes)
resolves #579