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


npm i filesize
yarn add filesize
pnpm add filesize


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



variable fileSize

var fileSize: Filesize.Filesize;


    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.


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

                                                        You may also use to create a custom badge linking to

                                                        • Markdown
                                                        • HTML
                                                          <a href=""><img src="" alt=""></a>