@types/bytes

  • Version 3.1.4
  • Published
  • 5.03 kB
  • No dependencies
  • MIT license

Install

npm i @types/bytes
yarn add @types/bytes
pnpm add @types/bytes

Overview

TypeScript definitions for bytes

Index

Functions

function bytes

bytes: typeof bytes;
  • Convert the given value in bytes into a string.

  • Parse string to an integer in bytes.

function format

format: (value: number, options?: BytesOptions) => string;
  • Format the given value in bytes into a string.

    If the value is negative, it is kept as such. If it is a float, it is rounded.

function parse

parse: (value: string | number) => number;
  • Parse the string value into an integer in bytes.

    If no unit is given, it is assumed the value is in bytes.

Interfaces

interface BytesOptions

interface BytesOptions {}

    property decimalPlaces

    decimalPlaces?: number | undefined;

      property fixedDecimals

      fixedDecimals?: boolean | undefined;

        property thousandsSeparator

        thousandsSeparator?: string | undefined;

          property unit

          unit?: Unit | undefined;

            property unitSeparator

            unitSeparator?: string | undefined;

              Type Aliases

              type Unit

              type Unit =
              | 'b'
              | 'gb'
              | 'kb'
              | 'mb'
              | 'pb'
              | 'tb'
              | 'B'
              | 'GB'
              | 'KB'
              | 'MB'
              | 'PB'
              | 'TB';

                Package Files (1)

                Dependencies (0)

                No dependencies.

                Dev Dependencies (0)

                No dev dependencies.

                Peer Dependencies (0)

                No peer dependencies.

                Badge

                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/bytes.

                • Markdown
                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/bytes)
                • HTML
                  <a href="https://www.jsdocs.io/package/@types/bytes"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>