
Product
Introducing Custom Pull Request Alert Comment Headers
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
image-bin-compressor
Advanced tools
A simple image compressor using node.js which take binary buffer as input and return compressed binary buffer as output
A simple Node.js utility designed to be used with Multer in server-side applications to compress data. It offers lossless compression using the gzip algorithm.
example usage, please refer to the EXAMPLE.md file.
You can install the package via npm:
npm install image-bin-compressor
Importing the Module
import { compressBinaryData, decompressBinaryData } from 'image-bin-compressor';
Compressing Binary Data
// binaryData is a Buffer containing the raw binary data of the image
const compressedData = await compressBinaryData(binaryData);
// Decompressing Binary Data
// compressedData is a Buffer containing the compressed binary data
const decompressedData = await decompressBinaryData(compressedData);
import { compressBinaryData, decompressBinaryData } from 'image-bin-compressor';
import fs from 'fs';
async function example() {
try {
// Read binary data from file
const binaryData = fs.readFileSync('image.jpg');
// Compress binary data
const compressedData = await compressBinaryData(binaryData);
// Decompress compressed data
const decompressedData = await decompressBinaryData(compressedData);
// Compare original binary data with decompressed data
console.log('Are original binary data and decompressed data equal?', Buffer.compare(binaryData, decompressedData) === 0);
} catch (error) {
console.error('Error:', error);
}
}
example();
FAQs
A simple image compressor using node.js which take binary buffer as input and return compressed binary buffer as output
We found that image-bin-compressor 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.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.