I was using the zlib library for gzipping my streams in React js using zlib.gzip() method. This was working perfectly fine a couple of months back. But recently I am getting an error saying Buffer.isBuffer() is not a function when I am trying to use the zlib.gzip() method. I noticed the same error for the gunzip, inflate and deflate methods too.
I am using nodejs version 14 and the zlib version 1.0.5.
Any kind of help is appreciated on this one.
Thanks !
edit:
adding the error stack,
TypeError: Buffer.isBuffer is not a function at _isUint8Array (http://localhost:5000/main.bundle.js:488941:17) at Gzip../node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_writable.js.Writable.write (http://localhost:5000/main.bundle.js:489169:36) at Gzip../node_modules/stream-browserify/node_modules/readable-stream/lib/_stream_writable.js.Writable.end (http://localhost:5000/main.bundle.js:489437:51) at zlibBuffer (http://localhost:5000/main.bundle.js:298272:10) at Object../node_modules/browserify-zlib/lib/index.js.exports.gzip (http://localhost:5000/main.bundle.js:298198:10) at Object.onClick (http://localhost:5000/main.bundle.js:68477:14) at Button.onClick (http://localhost:5000/main.bundle.js:464007:25) at Button.onClick (http://localhost:5000/main.bundle.js:437509:25) at HTMLUnknownElement.callCallback (http://localhost:5000/main.bundle.js:412829:14) at Object.invokeGuardedCallbackDev (http://localhost:5000/main.bundle.js:412878:16)
The error stack gives me the impression that you are running Zlib on the client-side (browser). Buffer API is only available on the server-side.