Skip to content

Latest commit

 

History

History
41 lines (23 loc) · 791 Bytes

File metadata and controls

41 lines (23 loc) · 791 Bytes

ts-humanize v1.0.0


ts-humanize / iBytesN

Function: iBytesN()

iBytesN(bytes, numberOfDigits): string

Defined in: bytes/bytes.ts:99

Produces a human-readable representation of an IEC size.

If numberOfDigits is less than or equal to the number of digits in bytes, the decimal part will be ommited.

See also: parseBytes

Parameters

bytes

number

numberOfDigits

number

Specifies the total number of digits to output, including the decimal part.

Returns

string

Example

IBytesN(82854982, 4) // "79.02 MiB"
IBytesN(123456789, 3) // "118 MiB"
IBytesN(123456789, 6) // "117.738 MiB"