@visulima/humanizer
Version:
Humanizer is a library for humanizing data in a human-readable form.
125 lines (121 loc) • 3.81 kB
TypeScript
import { F as FormateByteOptions, P as ParseByteOptions, D as DurationOptions } from './packem_shared/types-4Kt5giRg.js';
export { a as DurationDigitReplacements, b as DurationLanguage, c as DurationPiece, d as DurationUnit, e as DurationUnitMeasures, f as DurationUnitName, I as IntlLocale } from './packem_shared/types-4Kt5giRg.js';
declare const BYTE_SIZES: {
readonly iec: readonly [{
readonly long: "Bytes";
readonly short: "B";
}, {
readonly long: "Kibibytes";
readonly short: "KiB";
}, {
readonly long: "Mebibytes";
readonly short: "MiB";
}, {
readonly long: "Gibibytes";
readonly short: "GiB";
}, {
readonly long: "Tebibytes";
readonly short: "TiB";
}, {
readonly long: "Pebibytes";
readonly short: "PiB";
}, {
readonly long: "Exbibytes";
readonly short: "EiB";
}, {
readonly long: "Zebibytes";
readonly short: "ZiB";
}, {
readonly long: "Yobibytes";
readonly short: "YiB";
}];
readonly iec_octet: readonly [{
readonly long: "Octets";
readonly short: "o";
}, {
readonly long: "Kibioctets";
readonly short: "Kio";
}, {
readonly long: "Mebioctets";
readonly short: "Mio";
}, {
readonly long: "Gibioctets";
readonly short: "Gio";
}, {
readonly long: "Tebioctets";
readonly short: "Tio";
}, {
readonly long: "Pebioctets";
readonly short: "Pio";
}, {
readonly long: "Exbioctets";
readonly short: "Eio";
}, {
readonly long: "Zebioctets";
readonly short: "Zio";
}, {
readonly long: "Yobioctets";
readonly short: "Yio";
}];
readonly metric: readonly [{
readonly long: "Bytes";
readonly short: "Bytes";
}, {
readonly long: "Kilobytes";
readonly short: "KB";
}, {
readonly long: "Megabytes";
readonly short: "MB";
}, {
readonly long: "Gigabytes";
readonly short: "GB";
}, {
readonly long: "Terabytes";
readonly short: "TB";
}, {
readonly long: "Petabytes";
readonly short: "PB";
}, {
readonly long: "Exabytes";
readonly short: "EB";
}, {
readonly long: "Zettabytes";
readonly short: "ZB";
}, {
readonly long: "Yottabytes";
readonly short: "YB";
}];
readonly metric_octet: readonly [{
readonly long: "Octets";
readonly short: "o";
}, {
readonly long: "Kilo-octets";
readonly short: "ko";
}, {
readonly long: "Mega-octets";
readonly short: "Mo";
}, {
readonly long: "Giga-octets";
readonly short: "Go";
}, {
readonly long: "Tera-octets";
readonly short: "To";
}, {
readonly long: "Peta-octets";
readonly short: "Po";
}, {
readonly long: "Exa-octets";
readonly short: "Eo";
}, {
readonly long: "Zetta-octets";
readonly short: "Zo";
}, {
readonly long: "Yotta-octets";
readonly short: "Yo";
}];
};
type ByteSize = (typeof BYTE_SIZES)["iec_octet"][number]["short"] | (typeof BYTE_SIZES)["iec"][number]["short"] | (typeof BYTE_SIZES)["metric_octet"][number]["short"] | (typeof BYTE_SIZES)["metric"][number]["short"];
declare const parseBytes: (value: string, options?: ParseByteOptions) => number;
declare const formatBytes: (bytes: number, options?: FormateByteOptions<ByteSize>) => string;
declare const duration: (milliseconds: number, options?: DurationOptions) => string;
export { DurationOptions, FormateByteOptions, ParseByteOptions, duration, formatBytes, parseBytes };