Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
cds-pretty-bytes
Advanced tools
Convert bytes to a human readable string:
1337
→1.34 kB
Useful for displaying file sizes for humans.
Note that it uses base-10 (e.g. kilobyte). Read about the difference between kilobyte and kibibyte.
$ npm install pretty-bytes
const prettyBytes = require('pretty-bytes');
prettyBytes(1337);
//=> '1.34 kB'
prettyBytes(100);
//=> '100 B'
// Display file size differences
prettyBytes(42, {signed: true});
//=> '+42 B'
// Localized output using German locale
prettyBytes(1337, {locale: 'de'});
//=> '1,34 kB'
Type: number
The number to format.
Type: Object
Type: boolean
Default: false
Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.
Type: boolean
string
Default: false
(No localization)
true
: Localize the output using the system/browser locale.string
: Expects a BCP 47 language tag (For example: en
, de
, …)Note: Localization should generally work in browsers. Node.js needs to be built with full-icu
or system-icu
. Alternatively, the full-icu
module can be used to provide support at runtime.
MIT © Sindre Sorhus
FAQs
Convert bytes to a human readable string: 1337 → 1.34 kB
The npm package cds-pretty-bytes receives a total of 1 weekly downloads. As such, cds-pretty-bytes popularity was classified as not popular.
We found that cds-pretty-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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.