byte-human
v1.0.1
Published
Convert byte size to human-readable size
Downloads
92
Maintainers
Readme
byte-human
Convert byte size to human-readable size
Install
$ npm install byte-humanUsage
import byteHuman from "byte-human";
byteHuman(2324606976); // => 2.32 GBAPI
byteHuman(bytes, opts?)
Return: string
Convert byte size to human-readable size.
bytes
Type: number
opts?
Type: Object
Options you can configure.
separator?
Type: string | undefined
Separator between number and unit, default is space.
import byteHuman from "byte-human";
byteHuman(2324606976); // => 2.32 GB
byteHuman(2324606976, { separator: "_" }); // => 2.32_GBfixed?
Type: number | undefined
For Number#toFixed, default is 2.
import byteHuman from "byte-human";
byteHuman(2324606976); // => 2.32 GB
byteHuman(2324606976, { fixed: 1 }); // => 2.3 GBCopyright
Copyright © 2025-Present Hyper-Z11. Licensed under ISC License.
