{"name":"@types/bytes","version":"2.5.0","license":"MIT","_id":"@types/bytes@2.5.0","maintainers":[{"name":"types","email":"ryan.cavanaugh@microsoft.com"}],"contributors":[{"url":"https://github.com/danny8002/","name":"Zhiyuan Wang"}],"dist":{"shasum":"0cfff0bad709b0bba657f2c46cc7ca9d23c030ba","tarball":"http://registry-npm.ywwl.com/@types/bytes/download/@types/bytes-2.5.0.tgz","integrity":"sha512-f5c+O8IJmBX+NIwreBzOHITNMQswSTbGOu8QaTA1FVGhx/4AfNO+sDG4ZxG0c+xfdIxXtRLcQdx3UJXjCAj93A==","signatures":[{"sig":"MEUCIQCyafCZWWULt3p/t0HJeO6onjrQA6xW6pBNnJaUiwHXywIgTRjqADHOqii+XrJfpkKxHUeK9rc7Kq86vS3PaLlMJyc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":1890,"noattachment":false,"key":"/@types/bytes/-/@types/bytes-2.5.0.tgz"},"main":"","scripts":{},"_npmUser":{"name":"types","email":"ts-npm-types@microsoft.com"},"repository":{"url":"https://www.github.com/DefinitelyTyped/DefinitelyTyped.git","type":"git"},"description":"TypeScript definitions for bytes","directories":{},"dependencies":{},"peerDependencies":{},"typeScriptVersion":"2.0","_npmOperationalInternal":{"tmp":"tmp/bytes-2.5.0.tgz_1496367303976_0.3581559124868363","host":"s3://npm-registry-packages"},"typesPublisherContentHash":"0d95ade366ad11f9817a591aa867ef0cb1b197683010cf5acd0ab2a2fb343e7c","readme":"# Installation\r\n> `npm install --save @types/bytes`\r\n\r\n# Summary\r\nThis package contains type definitions for bytes (https://github.com/visionmedia/bytes.js).\r\n\r\n# Details\r\nFiles were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bytes.\r\n## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bytes/index.d.ts)\r\n````ts\r\n/**\n * Convert the given value in bytes into a string.\n *\n * @param value Number of bytes to convert.\n * @param options Formatting options.\n * @returns Formatted string, or null if value is invalid.\n *\n * @example\n * bytes(1024); // '1KB'\n * bytes(1000, { thousandsSeparator: ' ' }); // '1 000B'\n */\ndeclare function bytes(value: number, options?: bytes.BytesOptions): string | null;\n\n/**\n * Parse string to an integer in bytes.\n *\n * @param value String representation of bytes to parse.\n * @returns Number of bytes, or null if value is invalid.\n *\n * @example\n * bytes('1KB'); // 1024\n * bytes('10.5MB'); // 11010048\n */\ndeclare function bytes(value: string): number | null;\n\ndeclare namespace bytes {\n    type Unit = \"b\" | \"gb\" | \"kb\" | \"mb\" | \"pb\" | \"tb\" | \"B\" | \"GB\" | \"KB\" | \"MB\" | \"PB\" | \"TB\";\n\n    interface BytesOptions {\n        /**\n         * Number of decimal places to include. Default is `2`.\n         */\n        decimalPlaces?: number | undefined;\n        /**\n         * Whether to format with fixed decimal precision. Default is `false`.\n         */\n        fixedDecimals?: boolean | undefined;\n        /**\n         * Thousands separator character (e.g. `','` or `' '`). Default is `''`.\n         */\n        thousandsSeparator?: string | undefined;\n        /**\n         * Specific unit to force formatting into (e.g. `'MB'`, `'GB'`). Default is `''`.\n         */\n        unit?: Unit | undefined;\n        /**\n         * Separator between the number and metric unit. Default is `''`.\n         */\n        unitSeparator?: string | undefined;\n    }\n\n    /**\n     * Format the given value in bytes into a string.\n     *\n     * If the value is negative, it is kept as such.\n     * If it is a float, it is rounded.\n     *\n     * @param value Number of bytes to format.\n     * @param options Formatting options.\n     * @returns Formatted string, or null if value is invalid.\n     */\n    function format(value: number, options?: BytesOptions): string | null;\n\n    /**\n     * Parse the string value into an integer in bytes.\n     *\n     * If no unit is given, it is assumed the value is in bytes.\n     *\n     * @param value String representation or number to parse.\n     * @returns Number of bytes, or null if value is invalid.\n     */\n    function parse(value: string | number): number | null;\n}\n\nexport = bytes;\n\r\n````\r\n\r\n### Additional Details\r\n * Last updated: Fri, 21 Aug 2026 09:13:39 GMT\r\n * Dependencies: none\r\n\r\n# Credits\r\nThese definitions were written by [Zhiyuan Wang](https://github.com/danny8002), [Rickard Laurin](https://github.com/believer), [Florian Keller](https://github.com/ffflorian), and [Semih Gemi](https://github.com/semihgemi).\r\n","publish_time":1496367304614,"_cnpm_publish_time":1496367304614,"dist-tags":{"latest":"3.1.6","ts2.0":"3.0.0","ts2.1":"3.0.0","ts2.2":"3.0.0","ts2.3":"3.0.0","ts2.4":"3.0.0","ts2.5":"3.0.0","ts2.6":"3.0.0","ts2.7":"3.0.0","ts2.8":"3.1.0","ts2.9":"3.1.0","ts3.0":"3.1.0","ts3.1":"3.1.0","ts3.2":"3.1.0","ts3.3":"3.1.0","ts3.4":"3.1.0","ts3.5":"3.1.0","ts3.6":"3.1.1","ts3.7":"3.1.1","ts3.8":"3.1.1","ts3.9":"3.1.1","ts4.0":"3.1.1","ts4.1":"3.1.1","ts4.2":"3.1.1","ts4.3":"3.1.1","ts4.4":"3.1.1","ts4.5":"3.1.4","ts4.6":"3.1.4","ts4.7":"3.1.4","ts4.8":"3.1.4","ts4.9":"3.1.4","ts5.0":"3.1.5","ts5.1":"3.1.5","ts5.2":"3.1.5","ts5.3":"3.1.5","ts5.4":"3.1.5","ts5.5":"3.1.5","ts5.6":"3.1.6","ts5.7":"3.1.6","ts5.8":"3.1.6","ts5.9":"3.1.6","ts6.0":"3.1.6","ts7.0":"3.1.6","ts7.1":"3.1.6"}}