{"name":"@types/bytes","version":"3.1.1","license":"MIT","_id":"@types/bytes@3.1.1","maintainers":[{"name":"types","email":"ts-npm-types@microsoft.com"}],"contributors":[{"url":"https://github.com/danny8002","name":"Zhiyuan Wang","githubUsername":"danny8002"},{"url":"https://github.com/believer","name":"Rickard Laurin","githubUsername":"believer"},{"url":"https://github.com/ffflorian","name":"Florian Keller","githubUsername":"ffflorian"}],"homepage":"https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bytes","dist":{"shasum":"67a876422e660dc4c10a27f3e5bcfbd5455f01d0","tarball":"http://registry-npm.ywwl.com/@types/bytes/download/@types/bytes-3.1.1.tgz","fileCount":4,"integrity":"sha512-lOGyCnw+2JVPKU3wIV0srU0NyALwTBJlVSx5DfMQOFuuohA8y9S8orImpuIQikZ0uIQ8gehrRjxgQC1rLRi11w==","signatures":[{"sig":"MEUCIQDXKmB/zd5PupoZrO31rtBmlO99a2uUlHy1ZV7hSIvpvwIgR3+8QTgrT4XwQG3GAIGRUR4QApBNRO5V4jwFm4r+ocE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5747,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg5J9bCRA9TVsSAnZWagAA/gsP/20WjhXWfVsk4QBZtB1k\n0WfoB/Tuj7BN1L0JdMHABbnWx9j1MQZ6gxm80kNCssscgxx7be0b5fhASFqt\nFJA4l6UYmFo18UEkYbA9gk4ZxtmnNHvTDh3GobEY9uC6efzX70zZXrc+OGi+\nmqYzd5ufu11QfHBAlK89sdlQRD9ICoj0+96M/elR0IJ6uGUbiieopjcNe1Eb\npWKcMO9ki1dW2q/QhfJwM2q1qlS5TsL+tMXtWmwS81PcEzsdKqYHfdXVWdsJ\nEj6SWhp0wLP4y1WpGbsv8mVn+6Xs6WK0z+rGY5srM0JcMTteJX1FScoQ6ELF\nLVI67WhdDCYhW6uuJO00uWwFe7JF/m44He1WLeZ1X6+PY8NC3CxXEIqKLcp5\nQR1IKmiuE7gZ7CPox4a566h6NIU0c4aODbm6EeX6lmoA0BB8LXbFUbdq4sND\ngsSKbSPOmIqWIbVq+kWBAeaRksmCmn+Dj/eF6/rTQ5Rgavca9NGUNss2pY2N\naZq5BhIYivTiK5sLAkTP80V441VHSS9geq3gcH8nD2RlkOE0LxYA8qvSL5ci\npzPu0CtCKTlDcm4ALOD0+xYkmzhLbDVEhQNloVLCLT/55DLn07XVLHeChQsY\npUbCBvX2k0FV0z+Xw3sLHPT9jXOFxBja3+HWaaztKjU1uEcTxLDmXf3Jr42y\ne1ON\r\n=ubNE\r\n-----END PGP SIGNATURE-----\r\n","size":1993,"noattachment":false,"key":"/@types/bytes/-/@types/bytes-3.1.1.tgz"},"main":"","types":"index.d.ts","scripts":{},"_npmUser":{"name":"types","email":"ts-npm-types@microsoft.com"},"repository":{"url":"https://github.com/DefinitelyTyped/DefinitelyTyped.git","type":"git","directory":"types/bytes"},"description":"TypeScript definitions for bytes","directories":{},"dependencies":{},"_hasShrinkwrap":false,"typeScriptVersion":"3.6","_npmOperationalInternal":{"tmp":"tmp/bytes_3.1.1_1625595738940_0.9357883005109147","host":"s3://npm-registry-packages"},"typesPublisherContentHash":"7d94ddf1eb193829af756d2e0aecc6e1b0938f3d2f5d46a4c6bd3a7216f084a5","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":1625595739118,"_cnpm_publish_time":1625595739118,"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"}}