Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 17, 2024 via pnpm

pretty-bytes 6.1.0

Convert bytes to a human readable string: 1337 β†’ 1.34 kB
Package summary
Share
0
issues
1
license
1
MIT
Package created
9 Feb 2014
Version published
4 Feb 2023
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
pretty-bytes@6.1.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of pretty-bytes 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does pretty-bytes do?

The pretty-bytes npm package is designed to convert bytes into a human-readable string, making it particularly useful for displaying file sizes. By turning a raw number of bytes into a more understandable expression like '1.34 kB', pretty-bytes enables easier comprehension and handling of data-related metrics. It operates on base-10, otherwise known as the decimal system, which denotes the kilobyte (kB) measurement.

How do you use pretty-bytes?

To use the pretty-bytes npm package, you will first need to install it using the command:

npm install pretty-bytes

Once installed, you can import the package into your JavaScript code as follows:

import prettyBytes from 'pretty-bytes';

Then, you can invoke the prettyBytes function with the number of bytes you wish to convert. For example:

prettyBytes(1337); // Returns "1.34 kB"
prettyBytes(100); // Returns "100 B"

You can also use additional options to further customize the output:

prettyBytes(1337, {bits: true}); // Returns "1.34 kbit"

prettyBytes(42, {signed: true}); // Returns "+42 B"

prettyBytes(1337, {locale: 'de'}); // Returns "1,34 kB"

Where are the pretty-bytes docs?

The pretty-bytes documentation resides within the project's GitHub page (git+https://github.com/sindresorhus/pretty-bytes.git) and includes everything you need to know about the usage, properties, and customization of the pretty-bytes package. From basic installation and usage instructions to detailed explanations of various options and settings, all vital information related to the pretty-bytes library is readily accessible in the GitHub repository README file.