0

Having trouble finding a good way to decompress some input data I am being sent. I am using Next.js. Most tutorials I find use const zlib = require('zlib') or some such, but I find that syntax does not work for me. How do I import and use a library for decompressing gzip in Next.js?

user93114
  • 61
  • 5

1 Answers1

1

Okay, npm i pako did it.

import { Inflate } from "pako";


const zdecompress = (data: string) => {
    const inflate = new Inflate({ to: "string" });
    inflate.push(data, true);
    return inflate.result;
};
user93114
  • 61
  • 5