mscdex / busboy

A streaming parser for HTML form data for node.js
MIT License
2.84k stars 213 forks source link

Avoid using global Buffer #338

Closed jimmywarting closed 1 year ago

mscdex commented 1 year ago

Why?

jimmywarting commented 1 year ago

trying to assume that it exist globally is problematic for bundlers. it needs to scan the code if one is using globalThis.buffer and needs to decide if it have to polyfill it or not.

my own code can detect this kinds of patterns where ppl try to use globalThis.buffer and yours is one of them

mscdex commented 1 year ago

As far as linting goes, this project uses eslint and not xo. Attempting to support arbitrary linters and linting configurations doesn't make sense.

Regarding the aforementioned links and notes about deprecating global Buffer, that was only for ES modules. busboy is a CJS module.

jimmywarting commented 1 year ago

In any case i think you should attempt to only use Uint8Array instead of the overhead Buffer if at all possible.

mscdex commented 1 year ago

In any case i think you should attempt to only use Uint8Array instead of the overhead Buffer if at all possible.

That's not very feasible considering: