UNPKG

unitsnet-js

Version:

A better way to hold unit variables and easily convert to the destination unit

591 lines (590 loc) 19.6 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Information */ export interface InformationDto { /** The value of the Information */ value: number; /** The specific unit that the Information value is representing */ unit: InformationUnits; } /** InformationUnits enumeration */ export declare enum InformationUnits { /** */ Bytes = "Byte", /** */ Octets = "Octet", /** */ Bits = "Bit", /** */ Kilobytes = "Kilobyte", /** */ Megabytes = "Megabyte", /** */ Gigabytes = "Gigabyte", /** */ Terabytes = "Terabyte", /** */ Petabytes = "Petabyte", /** */ Exabytes = "Exabyte", /** */ Kibibytes = "Kibibyte", /** */ Mebibytes = "Mebibyte", /** */ Gibibytes = "Gibibyte", /** */ Tebibytes = "Tebibyte", /** */ Pebibytes = "Pebibyte", /** */ Exbibytes = "Exbibyte", /** */ Kilooctets = "Kilooctet", /** */ Megaoctets = "Megaoctet", /** */ Gigaoctets = "Gigaoctet", /** */ Teraoctets = "Teraoctet", /** */ Petaoctets = "Petaoctet", /** */ Exaoctets = "Exaoctet", /** */ Kibioctets = "Kibioctet", /** */ Mebioctets = "Mebioctet", /** */ Gibioctets = "Gibioctet", /** */ Tebioctets = "Tebioctet", /** */ Pebioctets = "Pebioctet", /** */ Exbioctets = "Exbioctet", /** */ Kilobits = "Kilobit", /** */ Megabits = "Megabit", /** */ Gigabits = "Gigabit", /** */ Terabits = "Terabit", /** */ Petabits = "Petabit", /** */ Exabits = "Exabit", /** */ Kibibits = "Kibibit", /** */ Mebibits = "Mebibit", /** */ Gibibits = "Gibibit", /** */ Tebibits = "Tebibit", /** */ Pebibits = "Pebibit", /** */ Exbibits = "Exbibit" } /** In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. */ export declare class Information extends BaseUnit { protected value: number; private bytesLazy; private octetsLazy; private bitsLazy; private kilobytesLazy; private megabytesLazy; private gigabytesLazy; private terabytesLazy; private petabytesLazy; private exabytesLazy; private kibibytesLazy; private mebibytesLazy; private gibibytesLazy; private tebibytesLazy; private pebibytesLazy; private exbibytesLazy; private kilooctetsLazy; private megaoctetsLazy; private gigaoctetsLazy; private teraoctetsLazy; private petaoctetsLazy; private exaoctetsLazy; private kibioctetsLazy; private mebioctetsLazy; private gibioctetsLazy; private tebioctetsLazy; private pebioctetsLazy; private exbioctetsLazy; private kilobitsLazy; private megabitsLazy; private gigabitsLazy; private terabitsLazy; private petabitsLazy; private exabitsLazy; private kibibitsLazy; private mebibitsLazy; private gibibitsLazy; private tebibitsLazy; private pebibitsLazy; private exbibitsLazy; /** * Create a new Information. * @param value The value. * @param fromUnit The ‘Information’ unit to create from. * The default unit is Bits */ constructor(value: number, fromUnit?: InformationUnits); /** * The base value of Information is Bits. * This accessor used when needs a value for calculations and it's better to use directly the base value */ get BaseValue(): number; /** Gets the default unit used when creating instances of the unit or its DTO */ protected get baseUnit(): InformationUnits.Bits; /** */ get Bytes(): number; /** */ get Octets(): number; /** */ get Bits(): number; /** */ get Kilobytes(): number; /** */ get Megabytes(): number; /** */ get Gigabytes(): number; /** */ get Terabytes(): number; /** */ get Petabytes(): number; /** */ get Exabytes(): number; /** */ get Kibibytes(): number; /** */ get Mebibytes(): number; /** */ get Gibibytes(): number; /** */ get Tebibytes(): number; /** */ get Pebibytes(): number; /** */ get Exbibytes(): number; /** */ get Kilooctets(): number; /** */ get Megaoctets(): number; /** */ get Gigaoctets(): number; /** */ get Teraoctets(): number; /** */ get Petaoctets(): number; /** */ get Exaoctets(): number; /** */ get Kibioctets(): number; /** */ get Mebioctets(): number; /** */ get Gibioctets(): number; /** */ get Tebioctets(): number; /** */ get Pebioctets(): number; /** */ get Exbioctets(): number; /** */ get Kilobits(): number; /** */ get Megabits(): number; /** */ get Gigabits(): number; /** */ get Terabits(): number; /** */ get Petabits(): number; /** */ get Exabits(): number; /** */ get Kibibits(): number; /** */ get Mebibits(): number; /** */ get Gibibits(): number; /** */ get Tebibits(): number; /** */ get Pebibits(): number; /** */ get Exbibits(): number; /** * Create a new Information instance from a Bytes * * @param value The unit as Bytes to create a new Information from. * @returns The new Information instance. */ static FromBytes(value: number): Information; /** * Create a new Information instance from a Octets * * @param value The unit as Octets to create a new Information from. * @returns The new Information instance. */ static FromOctets(value: number): Information; /** * Create a new Information instance from a Bits * * @param value The unit as Bits to create a new Information from. * @returns The new Information instance. */ static FromBits(value: number): Information; /** * Create a new Information instance from a Kilobytes * * @param value The unit as Kilobytes to create a new Information from. * @returns The new Information instance. */ static FromKilobytes(value: number): Information; /** * Create a new Information instance from a Megabytes * * @param value The unit as Megabytes to create a new Information from. * @returns The new Information instance. */ static FromMegabytes(value: number): Information; /** * Create a new Information instance from a Gigabytes * * @param value The unit as Gigabytes to create a new Information from. * @returns The new Information instance. */ static FromGigabytes(value: number): Information; /** * Create a new Information instance from a Terabytes * * @param value The unit as Terabytes to create a new Information from. * @returns The new Information instance. */ static FromTerabytes(value: number): Information; /** * Create a new Information instance from a Petabytes * * @param value The unit as Petabytes to create a new Information from. * @returns The new Information instance. */ static FromPetabytes(value: number): Information; /** * Create a new Information instance from a Exabytes * * @param value The unit as Exabytes to create a new Information from. * @returns The new Information instance. */ static FromExabytes(value: number): Information; /** * Create a new Information instance from a Kibibytes * * @param value The unit as Kibibytes to create a new Information from. * @returns The new Information instance. */ static FromKibibytes(value: number): Information; /** * Create a new Information instance from a Mebibytes * * @param value The unit as Mebibytes to create a new Information from. * @returns The new Information instance. */ static FromMebibytes(value: number): Information; /** * Create a new Information instance from a Gibibytes * * @param value The unit as Gibibytes to create a new Information from. * @returns The new Information instance. */ static FromGibibytes(value: number): Information; /** * Create a new Information instance from a Tebibytes * * @param value The unit as Tebibytes to create a new Information from. * @returns The new Information instance. */ static FromTebibytes(value: number): Information; /** * Create a new Information instance from a Pebibytes * * @param value The unit as Pebibytes to create a new Information from. * @returns The new Information instance. */ static FromPebibytes(value: number): Information; /** * Create a new Information instance from a Exbibytes * * @param value The unit as Exbibytes to create a new Information from. * @returns The new Information instance. */ static FromExbibytes(value: number): Information; /** * Create a new Information instance from a Kilooctets * * @param value The unit as Kilooctets to create a new Information from. * @returns The new Information instance. */ static FromKilooctets(value: number): Information; /** * Create a new Information instance from a Megaoctets * * @param value The unit as Megaoctets to create a new Information from. * @returns The new Information instance. */ static FromMegaoctets(value: number): Information; /** * Create a new Information instance from a Gigaoctets * * @param value The unit as Gigaoctets to create a new Information from. * @returns The new Information instance. */ static FromGigaoctets(value: number): Information; /** * Create a new Information instance from a Teraoctets * * @param value The unit as Teraoctets to create a new Information from. * @returns The new Information instance. */ static FromTeraoctets(value: number): Information; /** * Create a new Information instance from a Petaoctets * * @param value The unit as Petaoctets to create a new Information from. * @returns The new Information instance. */ static FromPetaoctets(value: number): Information; /** * Create a new Information instance from a Exaoctets * * @param value The unit as Exaoctets to create a new Information from. * @returns The new Information instance. */ static FromExaoctets(value: number): Information; /** * Create a new Information instance from a Kibioctets * * @param value The unit as Kibioctets to create a new Information from. * @returns The new Information instance. */ static FromKibioctets(value: number): Information; /** * Create a new Information instance from a Mebioctets * * @param value The unit as Mebioctets to create a new Information from. * @returns The new Information instance. */ static FromMebioctets(value: number): Information; /** * Create a new Information instance from a Gibioctets * * @param value The unit as Gibioctets to create a new Information from. * @returns The new Information instance. */ static FromGibioctets(value: number): Information; /** * Create a new Information instance from a Tebioctets * * @param value The unit as Tebioctets to create a new Information from. * @returns The new Information instance. */ static FromTebioctets(value: number): Information; /** * Create a new Information instance from a Pebioctets * * @param value The unit as Pebioctets to create a new Information from. * @returns The new Information instance. */ static FromPebioctets(value: number): Information; /** * Create a new Information instance from a Exbioctets * * @param value The unit as Exbioctets to create a new Information from. * @returns The new Information instance. */ static FromExbioctets(value: number): Information; /** * Create a new Information instance from a Kilobits * * @param value The unit as Kilobits to create a new Information from. * @returns The new Information instance. */ static FromKilobits(value: number): Information; /** * Create a new Information instance from a Megabits * * @param value The unit as Megabits to create a new Information from. * @returns The new Information instance. */ static FromMegabits(value: number): Information; /** * Create a new Information instance from a Gigabits * * @param value The unit as Gigabits to create a new Information from. * @returns The new Information instance. */ static FromGigabits(value: number): Information; /** * Create a new Information instance from a Terabits * * @param value The unit as Terabits to create a new Information from. * @returns The new Information instance. */ static FromTerabits(value: number): Information; /** * Create a new Information instance from a Petabits * * @param value The unit as Petabits to create a new Information from. * @returns The new Information instance. */ static FromPetabits(value: number): Information; /** * Create a new Information instance from a Exabits * * @param value The unit as Exabits to create a new Information from. * @returns The new Information instance. */ static FromExabits(value: number): Information; /** * Create a new Information instance from a Kibibits * * @param value The unit as Kibibits to create a new Information from. * @returns The new Information instance. */ static FromKibibits(value: number): Information; /** * Create a new Information instance from a Mebibits * * @param value The unit as Mebibits to create a new Information from. * @returns The new Information instance. */ static FromMebibits(value: number): Information; /** * Create a new Information instance from a Gibibits * * @param value The unit as Gibibits to create a new Information from. * @returns The new Information instance. */ static FromGibibits(value: number): Information; /** * Create a new Information instance from a Tebibits * * @param value The unit as Tebibits to create a new Information from. * @returns The new Information instance. */ static FromTebibits(value: number): Information; /** * Create a new Information instance from a Pebibits * * @param value The unit as Pebibits to create a new Information from. * @returns The new Information instance. */ static FromPebibits(value: number): Information; /** * Create a new Information instance from a Exbibits * * @param value The unit as Exbibits to create a new Information from. * @returns The new Information instance. */ static FromExbibits(value: number): Information; /** * Gets the base unit enumeration associated with Information * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof InformationUnits; /** * Gets the default unit used when creating instances of the unit or its DTO * @returns The unit enumeration value used as a default parameter in constructor and DTO methods */ protected static getBaseUnit(): InformationUnits.Bits; /** * Create API DTO represent a Information unit. * @param holdInUnit The specific Information unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: InformationUnits): InformationDto; /** * Create a Information unit from an API DTO representation. * @param dtoInformation The Information API DTO representation */ static FromDto(dtoInformation: InformationDto): Information; /** * Convert Information to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: InformationUnits): number; private convertFromBase; private convertToBase; /** * Format the Information to string. * Note! the default format for Information is Bits. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Information. * @param options The ToString options, it also can be the number of fractional digits to keep that deprecated and moved to the options object. support in number will be dropped in the upcoming versions. * @returns The string format of the Information. */ toString(unit?: InformationUnits, options?: number | ToStringOptions): string; /** * Get Information unit abbreviation. * Note! the default abbreviation for Information is Bits. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Information. * @returns The abbreviation string of Information. */ getUnitAbbreviation(unitAbbreviation?: InformationUnits): string; /** * Check if the given Information are equals to the current Information. * @param information The other Information. * @returns True if the given Information are equal to the current Information. */ equals(information: Information): boolean; /** * Compare the given Information against the current Information. * @param information The other Information. * @returns 0 if they are equal, -1 if the current Information is less then other, 1 if the current Information is greater then other. */ compareTo(information: Information): number; /** * Add the given Information with the current Information. * @param information The other Information. * @returns A new Information instance with the results. */ add(information: Information): Information; /** * Subtract the given Information with the current Information. * @param information The other Information. * @returns A new Information instance with the results. */ subtract(information: Information): Information; /** * Multiply the given Information with the current Information. * @param information The other Information. * @returns A new Information instance with the results. */ multiply(information: Information): Information; /** * Divide the given Information with the current Information. * @param information The other Information. * @returns A new Information instance with the results. */ divide(information: Information): Information; /** * Modulo the given Information with the current Information. * @param information The other Information. * @returns A new Information instance with the results. */ modulo(information: Information): Information; /** * Pow the given Information with the current Information. * @param information The other Information. * @returns A new Information instance with the results. */ pow(information: Information): Information; }