Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

brotli-fsize

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brotli-fsize

Get the brotli-compressed size of a string or buffer

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
302
increased by36.65%
Maintainers
1
Weekly downloads
 
Created
Source

brotli-fsize Build Status

Get the brotli-compressed size of a string or buffer

Install

Attention: This module is based on the native Brotli support, starting with Node version 11.7.0. Therefore it will only work with Node version equal to or higher.

$ npm install brotli-fsize

Usage

const brotliSize = require('brotli-fsize');
const text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.';

console.log(text.length);
//=> 191

console.log(brotliSize.sync(text));
//=> 134

API

brotliSize(input, [options])

Returns a Promise for the size.

brotliSize.sync(input, [options])

Returns the size.

input

Type: string Buffer

options

Type: Object

Any brotli option.

brotliSize.stream([options])

Returns a stream.PassThrough. The stream emits a brotli-fsize event and has a brotliSize property.

brotliSize.file(path, [options])

Returns a Promise for the size of the file.

path

Type: string

brotliSize.fileSync(path, [options])

Returns the size of the file.

License

Inspired by gzip-size

MIT © Developmint (Alexander Lichter)

Keywords

FAQs

Package last updated on 22 Jan 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