{"name":"@types/bytes","version":"2.4.33","author":"Zhiyuan Wang <https://github.com/danny8002/>","license":"MIT","_id":"@types/bytes@2.4.33","maintainers":[{"name":"types","email":"ryan.cavanaugh@microsoft.com"}],"dist":{"shasum":"5c614055c1cae736726c6970578197905941f7bd","tarball":"http://registry-npm.ywwl.com/@types/bytes/download/@types/bytes-2.4.33.tgz","integrity":"sha512-dj4brnErauz9NXebF8ws/3aPUdsElm8+iy2JZP1WlEV/yuKVUdCL5lRSZ5T9JVIT3NHHHo4D8LPVaAx40ZbBYQ==","signatures":[{"sig":"MEQCIAQr1xSEKuF98hFdhVlgZCvDxLkhWBCxbbeAb8B+E3f7AiArOjNvNyd9X5lpow5sBy0M/x/S3bTBCNiGMGK9Uca4iQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":1401,"noattachment":false,"key":"/@types/bytes/-/@types/bytes-2.4.33.tgz"},"main":"","scripts":{},"typings":"index.d.ts","_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 v2.4.0","directories":{},"dependencies":{},"_npmOperationalInternal":{"tmp":"tmp/bytes-2.4.33.tgz_1474302441592_0.3810616652481258","host":"packages-16-east.internal.npmjs.com"},"typesPublisherContentHash":"7edcf99629e3308b82c2d35bde1a1a34b942800fd2a1c9c9aa5d380a149a05c5","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":1474302443551,"_cnpm_publish_time":1474302443551,"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"}}