New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prettysize

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettysize

Convert bytes to other sizes for prettier logging

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
291K
increased by4.77%
Maintainers
1
Weekly downloads
 
Created

What is prettysize?

The prettysize npm package is a utility for converting file sizes into human-readable strings. It simplifies the process of displaying file sizes in a more understandable format, such as converting bytes into kilobytes, megabytes, etc.

What are prettysize's main functionalities?

Basic Usage

This feature allows you to convert a file size in bytes to a human-readable string. In this example, 123456789 bytes is converted to '117.7 MB'.

const prettysize = require('prettysize');
console.log(prettysize(123456789)); // '117.7 MB'

Customizing Units

This feature allows you to customize the units used in the conversion. By passing `true` as the second argument, the output uses binary units (MiB) instead of decimal units (MB).

const prettysize = require('prettysize');
console.log(prettysize(123456789, true)); // '117.7 MiB'

Specifying Number of Decimal Places

This feature allows you to specify the number of decimal places in the output. In this example, the output is formatted to two decimal places.

const prettysize = require('prettysize');
console.log(prettysize(123456789, {places: 2})); // '117.74 MB'

Other packages similar to prettysize

Keywords

FAQs

Package last updated on 07 Dec 2018

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