filesize

  • Version 8.0.3
  • Published
  • 59.7 kB
  • No dependencies
  • BSD-3-Clause license

Install

npm i filesize
yarn add filesize
pnpm add filesize

Overview

JavaScript library to generate a human readable String describing the file size

Index

Variables

variable fileSize

var fileSize: Filesize.Filesize;

    Namespaces

    namespace Filesize

    namespace Filesize {}

      interface Filesize

      interface Filesize {}

        property partial

        partial: (options: Options) => (bytes: number) => string;

          call signature

          (bytes: number, options?: Options): string;

            interface Options

            interface Options {}

              property base

              base?: number;
              • Number base, default is 2

              property bits

              bits?: boolean;
              • Enables bit sizes, default is false

              property exponent

              exponent?: number;
              • Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1

              property fullform

              fullform?: boolean;
              • Enables full form of unit of measure, default is false

              property fullforms

              fullforms?: string[];
              • Array of full form overrides, default is []

              property locale

              locale?: string | boolean;
              • BCP 47 language tag to specify a locale, or true to use default locale, default is ""

              property localeOptions

              localeOptions?: Intl.NumberFormatOptions;
              • ECMA-402 number format option overrides, default is "{}"

              property output

              output?: 'array' | 'exponent' | 'object' | 'string';
              • Output of function (array, exponent, object, or string), default is string

              property round

              round?: number;
              • Decimal place, default is 2

              property roundingMethod

              roundingMethod?: 'round' | 'floor' | 'ceil';
              • Rounding method, can be round, floor, or ceil, default is round

              property separator

              separator?: string;
              • Decimal separator character, default is .

              property spacer

              spacer?: string;
              • Character between the result and suffix, default is

              property standard

              standard?: 'iec' | 'jedec';
              • Standard unit of measure, can be iec or jedec, default is jedec; can be overruled by base

              property symbols

              symbols?: SiJedec;
              • Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found

              property unix

              unix?: boolean;
              • Enables unix style human readable output, e.g ls -lh, default is false

              interface SiJedecBits

              interface SiJedecBits {}

                property b

                b?: string;

                  property Eb

                  Eb?: string;

                    property Gb

                    Gb?: string;

                      property Kb

                      Kb?: string;

                        property Mb

                        Mb?: string;

                          property Pb

                          Pb?: string;

                            property Tb

                            Tb?: string;

                              property Yb

                              Yb?: string;

                                property Zb

                                Zb?: string;

                                  interface SiJedecBytes

                                  interface SiJedecBytes {}

                                    property B

                                    B?: string;

                                      property EB

                                      EB?: string;

                                        property GB

                                        GB?: string;

                                          property KB

                                          KB?: string;

                                            property MB

                                            MB?: string;

                                              property PB

                                              PB?: string;

                                                property TB

                                                TB?: string;

                                                  property YB

                                                  YB?: string;

                                                    property ZB

                                                    ZB?: string;

                                                      type SiJedec

                                                      type SiJedec = SiJedecBits & SiJedecBytes & { [name: string]: string };

                                                        Package Files (1)

                                                        Dependencies (0)

                                                        No dependencies.

                                                        Dev Dependencies (8)

                                                        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/filesize.

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