espressif/esptool-js

Why was the Buffer dependency added?

balloob opened this issue · 1 comments

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

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 ?