mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
17 lines
470 B
TypeScript
17 lines
470 B
TypeScript
import { gzip, ungzip } from 'node-gzip';
|
|
|
|
const testGzip = async () => {
|
|
const someBuffer = Buffer.from('hello');
|
|
const zipped1 = await gzip(someBuffer);
|
|
|
|
const zipped2 = await gzip('gzipping a string directly');
|
|
|
|
return [zipped1.byteLength, zipped2[0]];
|
|
};
|
|
|
|
const testUngzip = async () => {
|
|
const data = Buffer.from('H4sICHeEGV0AA2EA4wIAkwbXMgEAAAA=', 'base64');
|
|
const ungzipped = await ungzip(data);
|
|
return ungzipped.toString('utf-8');
|
|
};
|