Socket
Socket
Sign inDemoInstall

brotli-size

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brotli-size

Get the brotli compressed size of a string or buffer


Version published
Weekly downloads
189K
decreased by-10.1%
Maintainers
1
Weekly downloads
 
Created

What is brotli-size?

The brotli-size npm package is used to calculate the Brotli-compressed size of a given string or buffer. Brotli is a compression algorithm developed by Google that is particularly effective for web content compression.

What are brotli-size's main functionalities?

Calculate Brotli size of a string

This feature allows you to calculate the Brotli-compressed size of a given string synchronously. The code sample demonstrates how to import the brotli-size package, define a string, and then calculate and log its Brotli-compressed size.

const brotliSize = require('brotli-size');
const input = 'Hello, world!';
const size = brotliSize.sync(input);
console.log(`Brotli size: ${size} bytes`);

Calculate Brotli size of a buffer

This feature allows you to calculate the Brotli-compressed size of a given buffer synchronously. The code sample demonstrates how to import the brotli-size package, create a buffer from a string, and then calculate and log its Brotli-compressed size.

const brotliSize = require('brotli-size');
const input = Buffer.from('Hello, world!');
const size = brotliSize.sync(input);
console.log(`Brotli size: ${size} bytes`);

Asynchronous calculation of Brotli size

This feature allows you to calculate the Brotli-compressed size of a given string asynchronously. The code sample demonstrates how to import the brotli-size package, define a string, and then calculate and log its Brotli-compressed size using a promise.

const brotliSize = require('brotli-size');
const input = 'Hello, world!';
brotliSize(input).then(size => {
  console.log(`Brotli size: ${size} bytes`);
});

Other packages similar to brotli-size

Keywords

FAQs

Package last updated on 08 Aug 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc