@absolunet/ioc2.1.0

View on GitHub

FileHelper

File helper.

Members

bytes :bytes

Source:
The bytes module.

Methods

formatSize(size, optionsopt)

Source:
Get a human readable file size.
Parameters:
Name Type Attributes Description
size number The size to format.
options object <optional>
The options.
Properties
Name Type Attributes Description
decimalPlaces number <optional>
Maximum number of decimal places to include in output.
fixedDecimals number <optional>
Whether to always display the maximum number of decimal places.
thousandsSeparator string <optional>
The thousand separator, such as " ", "," and ".".
unit string <optional>
The unit in which the result will be returned (B/KB/MB/GB/TB).
unitSeparator string <optional>
Separator to use between number and unit.
Returns:
The formatted value.
Type
string | null

parseSize(size)

Source:
Parse a human readable file size to bytes number value.
Parameters:
Name Type Description
size string | number The size to parse.
Returns:
The parsed size.
Type
number | null