JSPM

byte-human

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q54457F
  • License ISC

Convert byte size to human-readable size

Package Exports

  • byte-human

Readme

byte-human

Convert byte size to human-readable size

Install

$ npm install byte-human

Usage

import byteHuman from 'byte-human';

byteHuman(2324606976); // => 2.32 GB

API

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_GB
fixed?

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 GB

Copyright © 2025-Present Hyper-Z11. Licensed under ISC License.