From ae61d34f7e11c6b1fd0b1d2c9a642c61ef404d0c Mon Sep 17 00:00:00 2001 From: Timur Shemsedinov Date: Fri, 8 Dec 2023 10:22:14 +0200 Subject: [PATCH] Add examples and docs --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 7a94577..f77ea37 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,11 @@ const result = await ac; - `md5(fileName: string): Promise` - `getX509(cert: X509Certificate): Strings` +```js +const x509 = new crypto.X509Certificate(cert); +const domains = metautil.getX509names(x509); +``` + ## Datetime utilities - `duration(s: string | number): number` @@ -265,6 +270,24 @@ semaphore.leave(); - `bytesToSize(bytes: number): string` - `sizeToBytes(size: string): number` +```js +const size = bytesToSize(100000000); +const bytes = sizeToBytes(size); +console.log({ size, bytes }); +// { size: '100 MB', bytes: 100000000 } +``` + +| Symbol | zeros | Unit | +|-------:|------:|-----------| +| yb | 24 | yottabyte | +| zb | 21 | zettabyte | +| eb | 18 | exabyte | +| pb | 15 | petabyte | +| tb | 12 | terabyte | +| gb | 9 | gigabyte | +| mb | 6 | megabyte | +| kb | 3 | kilobyte | + ## License & Contributors Copyright (c) 2017-2023 [Metarhia contributors](https://github.com/metarhia/metautil/graphs/contributors).