Tiago
CDCloudflare Developers
•Created by Tiago on 11/17/2023 in #workers-help
Workers zlib failure when trying to gunzip data
Hi all,
I'm trying to develop a worker that stores and fetches gzipped data in R2. Data is a ~300kb json file but when gzipped is only ~20kb.
I've enabled polyfills (setting
node_compat = true
in wrangler.toml) to be able to use zlib. Compressing the json works fine. However, when trying to uncompress it I'm getting the following
1. "TypeError: Not a string or buffer" when trying to use an ArrrayBuffer
2. "TypeError: Cannot read properties of undefined (reading '-5')" when converting data from R2 object to a Buffer.
Is there any supported way to uncompress a file in a worker?
I believe the issue might be in https://github.com/ionic-team/rollup-plugin-node-polyfills that you're using - but the library seems to be no longer maintained.7 replies