{"name":"pretty-ms","version":"8.0.0","description":"Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pretty-ms.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","types":"./index.d.ts","engines":{"node":">=14.16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["pretty","prettify","human","humanize","humanized","readable","time","ms","milliseconds","duration","period","range","text","string","number","hrtime"],"dependencies":{"parse-ms":"^3.0.0"},"devDependencies":{"ava":"^4.3.0","tsd":"^0.20.0","xo":"^0.49.0"},"gitHead":"73389247d677dd83587b43bed255b6d38b4b65a7","bugs":{"url":"https://github.com/sindresorhus/pretty-ms/issues"},"homepage":"https://github.com/sindresorhus/pretty-ms#readme","_id":"pretty-ms@8.0.0","_nodeVersion":"14.19.2","_npmVersion":"8.3.2","dist":{"integrity":"sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==","shasum":"a35563b2a02df01e595538f86d7de54ca23194a3","tarball":"http://registry-npm.ywwl.com/pretty-ms/download/pretty-ms-8.0.0.tgz","fileCount":5,"unpackedSize":11779,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHKy2cOYcxNZhGFrBWsExCASP/9H+2QWHIMcOXRKGwPrAiBFNc0xCA8S6+t3IHdgZisTAfq4zt3z3wRzNu+8CsZYLw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJinfhKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqB3BAAittVt+6vi3a0jgYTAt3Q8eLKw5AYmX2t6Ma1XK5fffehLPWv\r\nQf99ngKiNUh44rhpcqk2MCa3sS9h41OBnKzI9qSvBrTa6txPbkIUdAeQ/uVV\r\n9/VyfjPRko1l0Xr3xnm8deMC9BIAY9DPF5qqp1cl5sTvwqEE/yucsRXAx9Vj\r\nvJ/7Erej2eo0vVzMTvh3+GHpCbmRulW7re4DQf0T459BLXZ0Q7snuRJu9pCm\r\nrCHtqNoP1RC0L2p0gw5CP+zoib/rkNvFpGjVvJRARFrJvI6yRi2R1Qn/mkRH\r\n0EUNUUbfeveboUucbceM5avwp7jmRYJFlZ5BLU2bdJq8TL210TKTFezlLrxe\r\npRSXr31rqX5W82BPgNt5Scf6HrZGNZdEZWg3LWvMeC6KBS1hJhBBcy65a7p0\r\nJT4guNn5BUteFLIFhOH6XgsrINZisivEUwbGTNMfAwGC243pK1m/eaXRoCWd\r\ny7vMu6Uf8/BeNkaOZcY05LMOq/oaFpWYzjvuv7lyjtavwC0oE4UVEIWYQPqM\r\nQpp3Hdu9VVfz3muxeWywe5Q+PMCht61OsnejSlwxuUUfmcS/YQNO4Vfd7eHz\r\nrSymbm5HDXQKqnNbg3NUbfs5kcuEmKhKYTtSWpUpw39Di5rr5ZVVBsFp4Qlm\r\nxhAsi6mL3pBJPRm2XP8MDTZbF9cX5RR1CiY=\r\n=Tgkl\r\n-----END PGP SIGNATURE-----\r\n","size":3743,"noattachment":false,"key":"/pretty-ms/-/pretty-ms-8.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pretty-ms_8.0.0_1654519882544_0.8218428184653492"},"_hasShrinkwrap":false,"readme":"# pretty-ms\n\n> Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`\n\n## Install\n\n```sh\nnpm install pretty-ms\n```\n\n## Usage\n\n```js\nimport prettyMilliseconds from 'pretty-ms';\n\nprettyMilliseconds(1337000000);\n//=> '15d 11h 23m 20s'\n\nprettyMilliseconds(1337000000n);\n//=> '15d 11h 23m 20s'\n\nprettyMilliseconds(1337);\n//=> '1.3s'\n\nprettyMilliseconds(133);\n//=> '133ms'\n\n// `compact` option\nprettyMilliseconds(1337, {compact: true});\n//=> '1s'\n\n// `verbose` option\nprettyMilliseconds(1335669000, {verbose: true});\n//=> '15 days 11 hours 1 minute 9 seconds'\n\n// `colonNotation` option\nprettyMilliseconds(95500, {colonNotation: true});\n//=> '1:35.5'\n\n// `formatSubMilliseconds` option\nprettyMilliseconds(100.400080, {formatSubMilliseconds: true})\n//=> '100ms 400µs 80ns'\n\n// Can be useful for time durations\nprettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5))\n//=> '35m'\n```\n\n## API\n\n### prettyMilliseconds(milliseconds, options?)\n\n#### milliseconds\n\nType: `number | bigint`\n\nMilliseconds to humanize.\n\n#### options\n\nType: `object`\n\n##### secondsDecimalDigits\n\nType: `number`\\\nDefault: `1`\n\nNumber of digits to appear after the seconds decimal point.\n\n##### millisecondsDecimalDigits\n\nType: `number`\\\nDefault: `0`\n\nNumber of digits to appear after the milliseconds decimal point.\n\nUseful in combination with [`process.hrtime()`](https://nodejs.org/api/process.html#process_process_hrtime_time).\n\n##### keepDecimalsOnWholeSeconds\n\nType: `boolean`\\\nDefault: `false`\n\nKeep milliseconds on whole seconds: `13s` → `13.0s`.\n\nUseful when you are showing a number of seconds spent on an operation and don't want the width of the output to change when hitting a whole number.\n\n##### compact\n\nType: `boolean`\\\nDefault: `false`\n\nOnly show the first unit: `1h 10m` → `1h`.\n\nAlso ensures that `millisecondsDecimalDigits` and `secondsDecimalDigits` are both set to `0`.\n\n##### unitCount\n\nType: `number`\\\nDefault: `Infinity`\n\nNumber of units to show. Setting `compact` to `true` overrides this option.\n\n##### verbose\n\nType: `boolean`\\\nDefault: `false`\n\nUse full-length units: `5h 1m 45s` → `5 hours 1 minute 45 seconds`\n\n##### separateMilliseconds\n\nType: `boolean`\\\nDefault: `false`\n\nShow milliseconds separately. This means they won't be included in the decimal part of the seconds.\n\n##### formatSubMilliseconds\n\nType: `boolean`\\\nDefault: `false`\n\nShow microseconds and nanoseconds.\n\n##### colonNotation\n\nType: `boolean`\\\nDefault: `false`\n\nDisplay time using colon notation: `5h 1m 45s` → `5:01:45`. Always shows time in at least minutes: `1s` → `0:01`\n\nUseful when you want to display time without the time units, similar to a digital watch.\n\nSetting `colonNotation` to `true` overrides the following options to `false`:\n- `compact`\n- `formatSubMilliseconds`\n- `separateMilliseconds`\n- `verbose`\n\n## Related\n\n- [pretty-ms-cli](https://github.com/sindresorhus/pretty-ms-cli) - CLI for this module\n- [parse-ms](https://github.com/sindresorhus/parse-ms) - Parse milliseconds into an object\n- [to-milliseconds](https://github.com/sindresorhus/to-milliseconds) - Convert an object of time properties to milliseconds\n- [pretty-bytes](https://github.com/sindresorhus/pretty-bytes) - Convert bytes to a human readable string\n","publish_time":1654519882754,"_cnpm_publish_time":1654519882754,"dist-tags":{"latest":"10.0.0"}}