Fork me on GitHub
#nbb
<
2022-07-12
>
trgoodwin08:07:06

is there a good way to check if built in node global objects are available when using nbb? in the case i'm exploring now i'm trying to leverage

Buffer.from(data, 'base64')
but doesn't seem to find Buffer
(await (p/let [data "blah blah blah blah" ;; ... do stuff
               buff (.from Buffer data "base64")]
          (writeFileSync "data/blah.png" buff)

borkdude08:07:57

Maybe your Node.js is too old? I'm running 17.8.0 here and it has buffer. You can test if Buffer is available with:

(some? js/Buffer)

borkdude08:07:40

Maybe try (js/Buffer.from data "base64")

trgoodwin08:07:58

yeah.. i'm an idiot. just realised i forgot js/

❤️ 1