Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/pako
Advanced tools
TypeScript definitions for pako
@types/pako provides TypeScript type definitions for the pako library, which is a fast and efficient zlib port to JavaScript, primarily used for data compression and decompression.
Compression
This feature allows you to compress a string using the deflate algorithm. The code sample demonstrates how to compress a simple string and output the compressed result.
const pako = require('pako');
const input = 'Hello, world!';
const compressed = pako.deflate(input, { to: 'string' });
console.log(compressed);
Decompression
This feature allows you to decompress a previously compressed string using the inflate algorithm. The code sample shows how to decompress a base64 encoded compressed string and output the original string.
const pako = require('pako');
const compressed = 'eJzT0yMAAGTvBe8=';
const decompressed = pako.inflate(compressed, { to: 'string' });
console.log(decompressed);
Gzip Compression
This feature allows you to compress a string using the gzip algorithm. The code sample demonstrates how to gzip compress a simple string and output the compressed result.
const pako = require('pako');
const input = 'Hello, world!';
const compressed = pako.gzip(input, { to: 'string' });
console.log(compressed);
Gzip Decompression
This feature allows you to decompress a previously gzip compressed string using the ungzip algorithm. The code sample shows how to ungzip decompress a base64 encoded compressed string and output the original string.
const pako = require('pako');
const compressed = 'H4sIAAAAAAAAE8tIzcnJVyjPL8pJAQCFE0oNCwAAAA==';
const decompressed = pako.ungzip(compressed, { to: 'string' });
console.log(decompressed);
The zlib package is a core Node.js module that provides compression and decompression functionalities similar to pako. It supports both deflate and gzip algorithms. However, zlib is a native module and may offer better performance compared to pako, which is a JavaScript implementation.
node-zopfli is a Node.js binding for the Zopfli compression algorithm, which is known for its high compression ratio. It supports both deflate and gzip algorithms. Compared to pako, node-zopfli may provide better compression at the cost of slower compression speed.
lz-string is a JavaScript library for compressing and decompressing strings using LZ-based compression algorithms. It is designed to be lightweight and fast, making it suitable for client-side usage. Unlike pako, lz-string does not support gzip or deflate algorithms.
npm install --save @types/pako
This package contains type definitions for pako (https://github.com/nodeca/pako).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pako.
These definitions were written by Caleb Eggensperger, Muhammet Öztürk, and Thibault Poisson.
FAQs
TypeScript definitions for pako
We found that @types/pako demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.