zlib#gzip TypeScript Examples

The following examples show how to use zlib#gzip. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: serialize.ts    From vanilla-extract with MIT License 5 votes vote down vote up
zip = promisify(gzip)
Example #2
Source File: http.ts    From code-client with MIT License 5 votes vote down vote up
export async function compressAndEncode(payload: any): Promise<Buffer> {
  // encode payload and compress;
  const deflate = promisify(gzip);
  const compressedPayload = await deflate(Buffer.from(JSON.stringify(payload)).toString('base64'));
  return compressedPayload;
}