Using Buffer Class that's not available in js

I’m trying to use the Buffer class that’s globally available in Node.js, but I’m failing to get the Retool js script editor to recognize the class as it does not support the Buffer class. Does anyone know any existing libraries that can replace the missing class?

Hey James, the Node.js Buffer is by default not available in browsers which is why it doesn’t work out of the box. One way to get around this is to import a library into Retool and use that. Here are docs on how you can do that:

I found a library that ports the Nodejs buffer to the browser:

Here’s the link to the CDN you’d need to add in your Retool settings page:

Let us know if that works!

1 Like

Hi Yogi,

Thanks for the follow up, I was able to refactor what I wanted using JavaScript’s Array buffer class.