Skip to content
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

minimumBytes was not properly deprecated, breaking change #328

Closed
arciisine opened this issue Feb 9, 2020 · 4 comments
Closed

minimumBytes was not properly deprecated, breaking change #328

arciisine opened this issue Feb 9, 2020 · 4 comments

Comments

@arciisine
Copy link

arciisine commented Feb 9, 2020

in 14.0.0 (a major release), minimumBytes was removed (not deprecated) (#319 ).

This has had a breaking change on code that relies on that constant being exposed. A proper deprecation path would be appreciated.

@sindresorhus
Copy link
Owner

It's still there:

const buffer = Buffer.alloc(minimumBytes);

@Borewit
Copy link
Collaborator

Borewit commented Feb 9, 2020

It's still there:

file-type/core.js

Lines 60 to 63 in b280b91

const buffer = Buffer.alloc(minimumBytes);
await tokenizer.ignore(ignoreBytes);
await tokenizer.peekBuffer(buffer, {length: 512, mayBeLess: true});

The usage of minimumBytes (which is private value now) does not make any sense in that line, it should be 512 or the length: 512 should be removed. (fixing PR: #329)

You are right @arciisine, it was already depricated since (#286, v13.0.0), and now it has been removed.

You can pass any number of bytes @arciisine. There is no special number of bytes anymore, other then the total number of bytes of the file you wish to analyze.

@arciisine
Copy link
Author

arciisine commented Feb 9, 2020 via email

@Borewit
Copy link
Collaborator

Borewit commented Feb 9, 2020

I plan on updating my code to not rely on that constant, but the wording of
the change may surprise others as well.

Very good. Try to use fromFile() if possible. I updated the title of #319 and release description of v14.0.0.

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

No branches or pull requests

3 participants