
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
simplify-bytes
Advanced tools
Simplifies bytes to a human-readable size string.
$ npm i -save simplify-bytes
or
$ yarn add simplify-bytes
import { simplifyBytes, simplifyBiBytes } from 'simplify-bytes';
simplifyBytes(200); // '200B'
simplifyBytes(2048); // '2.048KB'
simplifyBytes(20480); // '20.48KB'
simplifyBiBytes(200); // '200B'
simplifyBiBytes(2048); // '2KiB'
simplifyBiBytes(20480); // '20KiB'
Type: number
Number to format.
Type: number | object
Optional settings.
If number: Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.
simplifyBytes(2048, 1); // '2.0KB'
simplifyBytes(2048, 2); // '2.05KB'
If object:
binary
Type: boolean
Default: false
Format the value using the binary-prefix or si-prefix.\
false: Using the si-prefix (base 1000).true: Using the binary-prefix (base 1024). simplifyBytes(2048, {binary: true}); // '2KiB', same as using: simplifyBiBytes(2048).
decimals
Type: number
Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.
simplifyBytes(2048, {decimals: 2}); // '2.05KB', same as using: simplifyBytes(2048, 2).
separator
Type: string
Character between the number and unit.
simplifyBytes(2048, {separator: ' '}); // '2.048 KB'
Format the value using the binary-prefix.
Type: number
Number to format.
Type: number | object
Optional settings. The arguments are the same as the 'simplifyBytes' method, except that 'binary' is true.
FAQs
Simplifies bytes to a human-readable size string
The npm package simplify-bytes receives a total of 1 weekly downloads. As such, simplify-bytes popularity was classified as not popular.
We found that simplify-bytes 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.