UNPKG

rjweb-server

Version:

Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS

50 lines (49 loc) 1.15 kB
import { Multiply } from "ts-arithmetic"; declare class Size<Amount extends number> { private amount; /** * Initialize a new Size Class * @since 8.0.0 */ constructor(amount: Amount); /** * Use the provided amount as bytes * @example * ``` * size(10).b() // 10 * ``` * @since 8.0.0 */ b(): Amount; /** * Use the provided amount as kilobytes * @example * ``` * size(10).kb() // 10240 * ``` * @since 8.0.0 */ kb(): Multiply<Amount, 1024>; /** * Use the provided amount as megabytes * @example * ``` * size(10).mb() // 10485760 * ``` * @since 8.0.0 */ mb(): Multiply<Multiply<Amount, 1024>, 1024>; /** * Use the provided amount as gigabytes * @example * ``` * size(10).gb() // 10737418240 * ``` * @since 8.0.0 */ gb(): Multiply<Multiply<Multiply<Amount, 1024>, 1024>, 1024>; } /** * Utility for defining bytes * @example * ``` * size(10).gb() // 10737418240 * ``` * @since 8.0.0 */ export default function size<Amount extends number>(amount: Amount): Size<Amount>; export {};