espressif / esptool-js

Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.
https://espressif.github.io/esptool-js/
Apache License 2.0
288 stars 108 forks source link

Why was the Buffer dependency added? #130

Closed balloob closed 8 months ago

balloob commented 9 months ago

I hadn't seen the introduction on Buffer because it was hidden inside the JSDoc API PR #108, which I assumed was only adding documentation.

The buffer npm package is 2000 lines of JavaScript for a total of 26kB. Previously, esptool-js worked without it. @brianignacio5 can you explain why esptool-js needs this dependency?

Size and impact of bundling buffer npm package (via bundlephobia)

image
brianignacio5 commented 8 months ago

Hi @balloob Sorry for late reply. There is a reference to atob and btoa which is supported in browsers but not in NodeJS environments.

I'm not sure of how to handle both cases since some users want to extend this tool for more environments (#117). I figured using a separated Buffer library might offer for both cases. Any ideas of a lighter solution for this ?