パッケージの詳細

filesize

avoidwork52.7mBSD-3-Clause11.0.1

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

file, filesize, size, readable

readme

filesize.js

downloads npm version Node.js Version License Build Status

A lightweight, high-performance file size utility for JavaScript that converts bytes to human-readable strings. Works in both Node.js and browser environments with comprehensive format support.

Installation

npm install filesize

Usage

ES Modules

import {filesize} from "filesize";
filesize(265318, {standard: "jedec"}); // "259.1 KB"

CommonJS

const {filesize} = require("filesize");
filesize(1024); // "1.02 kB"

Partial Application

import {partial} from "filesize";
const size = partial({standard: "jedec"});
size(265318); // "259.1 KB"

Parameters

  • input {Number|String|BigInt} - The value to convert (required)
  • options {Object} - Configuration object (optional)

Options Object

  • base {Number} - Number base, default is 10
  • bits {Boolean} - Enables bit sizes, default is false
  • exponent {Number} - Specifies the symbol via exponent, e.g. 2 is MB for base 2, default is -1
  • fullform {Boolean} - Enables full form of unit of measure, default is false
  • fullforms {Array} - Array of full form overrides, default is []
  • locale {String|Boolean} - BCP 47 language tag to specify a locale, or true to use default locale, default is ""
  • localeOptions {Object} - Dictionary of options defined by ECMA-402 (Number.prototype.toLocaleString)
  • output {String} - Output of function (array, exponent, object, or string), default is string
  • pad {Boolean} - Decimal place end padding, default is false
  • precision {Number} - Sets precision of numerical output, default is 0
  • round {Number} - Decimal place, default is 2
  • roundingMethod {String} - Rounding method, can be round, floor, or ceil, default is round
  • separator {String} - Decimal separator character, default is an empty string
  • spacer {String} - Character between the result and symbol, default is " "
  • standard {String} - Standard unit of measure, can be iec, jedec, or si. Default is si (base 10)
  • symbols {Object} - Dictionary of IEC/JEDEC symbols to replace for localization

Input Validation

The function validates input and throws TypeError for invalid values:

// Invalid input will throw TypeError
try {
  filesize("invalid");
} catch (error) {
  console.error(error.message); // "Invalid input"
}

try {
  filesize(NaN);
} catch (error) {
  console.error(error.message); // "Invalid input"
}

Testing

filesize.js maintains 100% test coverage across all metrics with a comprehensive test suite of 47 test cases:

-------------|---------|----------|---------|---------|-------------------
File         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------|---------|----------|---------|---------|-------------------
All files    |     100 |      100 |     100 |     100 |                   
 filesize.js |     100 |      100 |     100 |     100 |                   
-------------|---------|----------|---------|---------|-------------------

Running Tests

# Run all tests (linting + unit tests)
npm test

# Run only unit tests
npm run mocha

Test Coverage

The test suite comprehensively covers:

  • Basic functionality: Core conversion logic and edge cases
  • Output formats: All output types (string, array, object, exponent)
  • Standards support: IEC, JEDEC, and SI standards with different bases
  • Bit conversion: Bits vs bytes with auto-increment logic
  • Precision handling: Rounding methods and decimal precision
  • Localization: Locale formatting and custom symbols
  • Error handling: Invalid inputs and boundary conditions
  • Partial functions: All option combinations with curried functions

Performance Benchmarks

filesize.js is optimized for high performance with comprehensive benchmarks covering various usage patterns:

🚀 Performance Overview

Scenario Operations/sec Notes
Basic conversion ~8-19M ops/sec Fastest operations (small numbers)
Large numbers ~8-15M ops/sec Consistent performance
With options ~2-8M ops/sec Depends on option complexity
Locale formatting ~85K ops/sec Most expensive operation
Partial functions ~6-8M ops/sec ~10-20% overhead, amortized

📊 Detailed Benchmark Results

Basic Performance

  • filesize(0): 18.8M ops/sec
  • filesize(1024): 14.5M ops/sec
  • filesize(1GB): 8.5M ops/sec
  • With bits=true: 13.1M ops/sec
  • With standard="iec": 7.9M ops/sec
  • With fullform=true: 6.6M ops/sec
  • Object output: 9.0M ops/sec

Options Performance Impact

  • Default options: 6.4M ops/sec (baseline)
  • bits=true: 1.66x slower
  • pad=true: 2.74x slower
  • locale="en-US": 75x slower (significant overhead)
  • standard="iec": 1.12x slower
  • output="object": 0.96x faster
  • Complex combinations: 1.6-2.1x slower

Stress Test Results

  • Edge cases: 2.0M ops/sec (90% success rate)
  • Very large numbers: 3.7M ops/sec (100% success)
  • BigInt values: 2.8M ops/sec (100% success)
  • Memory pressure: 48K ops/sec (100% success)
  • Performance consistency: 84.7% (10 runs average)

Partial Function Performance

  • Direct calls: 8.0M ops/sec (baseline)
  • Simple partial: 6.7M ops/sec (1.20x slower)
  • Complex partial: 5.6M ops/sec (1.42x slower)
  • Partial with locale: 84K ops/sec (95x slower)

💡 Performance Insights

Excellent Performance (>1M ops/sec)

  • Basic conversions with minimal options
  • Standard output formats (string, array, object)
  • IEC and JEDEC standards

Good Performance (100K-1M ops/sec)

  • Complex option combinations
  • Precision and rounding operations
  • Fullform output

Use Sparingly (<100K ops/sec)

  • Locale formatting (significant overhead)
  • Complex locale configurations

🎯 Optimization Tips

  1. Cache partial functions for repeated operations with same options
  2. Avoid locale formatting in performance-critical code
  3. Use object output for fastest structured data
  4. Batch similar operations together
  5. Profile your specific usage patterns

Running Benchmarks

# Run all benchmarks
cd benchmarks && node index.js

# Run specific benchmark
node benchmarks/basic-performance.js

# With garbage collection (more accurate)
node --expose-gc benchmarks/index.js

Benchmarks run on macOS ARM64, Node.js v23.10.0, 12 CPU cores, 24GB RAM

API Reference

Functions

filesize(input, options)

Converts a numeric value to a human-readable file size string.

Parameters:

  • input {Number|String|BigInt} - The value to convert
  • options {Object} - Configuration options (optional)

Returns: {String|Array|Object|Number} - Formatted size based on output option

filesize(500); // "500 B"
filesize(1024, {base: 2}); // "1 KiB"
filesize(265318, {output: "array"}); // [265.32, "kB"]

See also: partial()

partial(options)

Creates a pre-configured filesize function with options applied.

Parameters:

  • options {Object} - Configuration options to apply

Returns: {Function} - New function with options pre-applied

const formatBinary = partial({base: 2, standard: "iec"});
formatBinary(1048576); // "1 MiB"

const formatBits = partial({bits: true});
formatBits(1024); // "8.19 kbit"

See also: filesize()

Output Formats

String Output (default)

filesize(265318); // "265.32 kB"
filesize(265318, {separator: ","}); // "265,32 kB"

Array Output

filesize(265318, {output: "array"}); // [265.32, "kB"]
filesize(1024, {output: "array", base: 2}); // [1, "KiB"]

Object Output

filesize(265318, {output: "object"}); 
// {value: 265.32, symbol: "kB", exponent: 1, unit: "kB"}

Exponent Output

filesize(1024, {output: "exponent"}); // 1
filesize(1048576, {output: "exponent", base: 2}); // 2

Standards Support

SI (International System of Units) - Default

filesize(1000); // "1 kB" (base 10)
filesize(1000000); // "1 MB"

IEC (International Electrotechnical Commission)

filesize(1024, {standard: "iec", base: 2}); // "1 KiB"
filesize(1048576, {standard: "iec", base: 2}); // "1 MiB"

JEDEC (Joint Electron Device Engineering Council)

filesize(1024, {standard: "jedec"}); // "1 KB"
filesize(1048576, {standard: "jedec"}); // "1 MB"

Examples

Basic Usage

import {filesize} from "filesize";

filesize(500); // "500 B"
filesize(1024); // "1.02 kB"
filesize(265318); // "265.32 kB"
filesize(265318, {round: 0}); // "265 kB"

Binary Formats

// IEC binary prefixes (KiB, MiB, GiB)
filesize(1024, {base: 2, standard: "iec"}); // "1 KiB"
filesize(1048576, {base: 2, standard: "iec"}); // "1 MiB"

// JEDEC binary format (KB, MB, GB with binary calculation)
filesize(1024, {standard: "jedec"}); // "1 KB"
filesize(265318, {standard: "jedec"}); // "259.1 KB"

Bits vs Bytes

filesize(500, {bits: true}); // "4 kbit"
filesize(1024, {bits: true}); // "8.19 kbit"
filesize(1024, {bits: true, base: 2}); // "8 kibit"

Custom Formatting

// Full form units
filesize(1024, {fullform: true}); // "1.02 kilobytes"
filesize(1024, {base: 2, fullform: true}); // "1 kibibytes"

// Custom separators and spacing
filesize(265318, {separator: ","}); // "265,32 kB"
filesize(265318, {spacer: ""}); // "265.32kB"

// Precision and padding
filesize(1536, {round: 3, pad: true}); // "1.536 kB"
filesize(1536, {precision: 3}); // "1.54 kB"

Localization

// German locale
filesize(265318, {locale: "de"}); // "265,32 kB"

// Custom symbols
filesize(1, {symbols: {B: "Б"}}); // "1 Б"

// Custom full forms
filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов"

Advanced Usage

// Specific exponent
filesize(1024, {exponent: 0}); // "1024 B"
filesize(1024, {exponent: 1}); // "1.02 kB"

// BigInt support
filesize(BigInt(1024), {standard: "jedec"}); // "1 KB"

// Extreme precision for very large numbers
filesize(Math.pow(1024, 8), {precision: 3}); // "1208925819614629174706176 YB"

Partial Application Patterns

import {partial} from "filesize";

// Create specialized formatters
const formatBinary = partial({base: 2, standard: "iec"});
const formatBits = partial({bits: true});
const formatPrecise = partial({round: 3, pad: true});
const formatGerman = partial({locale: "de"});

// Use throughout application
formatBinary(1048576); // "1 MiB"
formatBits(1024); // "8.19 kbit"
formatPrecise(1536); // "1.536 kB"
formatGerman(265318); // "265,32 kB"

// Method chaining equivalent
const sizes = [1024, 2048, 4096];
sizes.map(formatBinary); // ["1 KiB", "2 KiB", "4 KiB"]

Development

This project follows Node.js best practices and uses:

  • ES Modules for modern JavaScript
  • Mocha for testing with comprehensive coverage
  • ESLint for code quality and consistency
  • Rollup for building distributions
  • TypeScript definitions for type safety

Project Structure

filesize.js/
├── src/
│   ├── filesize.js      # Main implementation
│   └── constants.js     # Unit definitions and constants
├── tests/
│   └── unit/
│       └── filesize.test.js  # Comprehensive test suite
├── types/
│   ├── filesize.d.ts    # TypeScript definitions
│   └── constants.d.ts   # Constants type definitions
└── package.json         # Dependencies and scripts

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Write tests for your changes
  4. Ensure all tests pass (npm test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Commands

# Install dependencies
npm install

# Run linting
npm run lint

# Run tests
npm test

# Build distribution
npm run build

# Run all checks (lint + test)
npm run ci

License

Copyright (c) 2025 Jason Mulligan
Licensed under the BSD-3 license.

更新履歴

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

11.0.1

11.0.0

11 July 2025

  • Updating all the things #188
  • Bump rollup from 4.18.1 to 4.22.4 #186

10.1.6

4 September 2024

  • Fixing regression due to rollup config, fixes #185 #185
  • Missed the nullish coercion with last commit 10d1fc6
  • Generated CHANGELOG.md 6eaa3ce
  • Generated CHANGELOG.md b480b29

10.1.5

3 September 2024

  • Fixing implementation of 'pad' such that 'separator' is not required for it to be applied, fixes #184 #184
  • Generated CHANGELOG.md 0248be0

10.1.4

8 July 2024

  • Fixing type def of 'partial()' 0e1516a
  • Generated CHANGELOG.md bb0fe7c

10.1.3

8 July 2024

  • fix: add bigint in filesize.d.ts #183
  • Bump braces from 3.0.2 to 3.0.3 #182
  • Updating dependencies 400b3e3
  • Generated CHANGELOG.md 5b2198a

10.1.2

11 May 2024

  • fix: input type should accept string #181
  • Version bump to release, generating CHANGELOG.md e840b87
  • Updating the year in LICENSE & README.md c9840ae

10.1.1

21 March 2024

  • Rework types to allow Parameters<typeof filesize> to function properly #180
  • Bump @babel/traverse from 7.23.0 to 7.23.2 #178
  • Version bump to release new types declaration cf1dcb7
  • change: rework types to allow usages like Parameters<typeof filesize> fbfc87f
  • Generating CHANGELOG.md d80c457

10.1.0

3 October 2023

  • Fixing tests to use strictEqual() 6b4b108
  • Simplifying the assignment of base & standard, adding an si alias to correct implementations, fixing tests for the standards, adding tests for si standard, updating types, updating README.md 720c032
  • Generated CHANGELOG.md b591a66

10.0.13

3 October 2023

  • Symbol option type fix #177
  • Merge latest #1
  • Adding a test, fixing a test, adding nyc for test coverage reporting, updating README.md, returning .npmignore, updating .gitignore 7a61c30
  • Adding a workflow cb26761
  • Adding husky for a pre-commit hook 0e7d0ba

10.0.12

12 August 2023

  • Allow passing options without output property #174
  • remove any usage and allow passing options without output property c42acc0
  • Version bump, generating CHANGELOG.md 901be1f

10.0.11

10 August 2023

  • Version bump 'cause npm has inane rules for releases 5544cb7
  • Generating CHANGELOG.md dea30ba

10.0.10

10 August 2023

  • Revert "Tweaking types and removing any usage" 3aee3e8
  • Version bump to release, generating CHANGELOG.md d1c1247

10.0.9

9 August 2023

  • Tweaking types and removing any usage #172
  • Version bump to release, generating CHANGELOG.md 80dcac5

10.0.8

27 July 2023

  • fixup: Add interface for filesize options object #171
  • Bump word-wrap from 1.2.3 to 1.2.4 #170
  • Version bump to release, generating CHANGELOG.md c9fff4f

10.0.7

29 March 2023

  • Updating copyright year in README.md & LICENSE, updating dependencies 4de5566
  • Updating CHANGELOG.md d41818f
  • Generating CHANGELOG.md a324b71

10.0.6

12 December 2022

  • Setting engines.node to &gt;= 10.4.0 for lowest version supporting BigInt, fixing npm run build for windows (needs gow) 0a4d329
  • Minor tweak daf5389
  • Updating CHANGELOG.md d110a35

10.0.5

12 December 2022

  • Fix web pack #164
  • Reverting revert to default export, removing browser key from package.json as it's redirection away from main or module is what breaks webpack, fixes #162 #162
  • Version bump to release reverted README.md ee1a977
  • Updating CHANGELOG.md, version bump to release 71a6336
  • Revert "Updating README.md" 87f817c

10.0.3

29 September 2022

  • Switching back to a default export for webpack issues (unsure of where the issue is atm), fixes #162 #162
  • Building version bump b80a38d
  • Updating README.md d826155
  • Updating CHANGELOG.md bd259de

10.0.2

28 September 2022

  • Fixing rollup config (copy/pasta), version bump to release, fixes #162 #162
  • Updating CHANGELOG.md 24501d0

10.0.1

28 September 2022

  • Lowering minimum version to 14.0.0, fixes #161 #161
  • Building with new version number, updating CHANGELOG.md 9d81ad1

10.0.0

28 September 2022

  • BigInts and named exports #160
  • Adding support for BigInt numbers, fixes #146 #146
  • Building with revision dependencies 00ff1ae
  • Updating tests to run within mocha 091a7cc
  • Regenerating CHANGELOG.md 3b40756

9.0.11

27 June 2022

  • Adding invaid base 10 iec test set, building 38221a0
  • Adding invaid base 10 iec test set, building, version bump to release 7b75cae
  • Updating changelog 893d312

9.0.10

27 June 2022

  • Fixing base 2 jedec regression with refactoring #158
  • Adding dupe set of base2 tests explicitly set to jedec standard to expose logic error 1281269
  • Fixing the conditional statement which assigns standard if base has been specified, updating bit tests in base2Jedec set dc7c3a4
  • Version bump to release f924463

9.0.9

17 June 2022

  • Fix regression of output from 9.x.x #155
  • Returning original logic, taking tests from 8.x.x, creating a constants.js & moving all strings into it as named exports 22c3911
  • Building 295907c
  • Fixing unit assignment (WIP) 70bb6a1

9.0.8

16 June 2022

  • Updating README.md to remove examples, fixes #154 #154
  • Version bump to release updated README.md, updating changelog c798056

9.0.7

16 June 2022

  • Returning strict mode to core function f6d2b87
  • Version bump to release, updating CHANGELOG.md 06e4214
  • Building 8f6641b

9.0.6

16 June 2022

  • Fixing assignment of base and returning original behavior, fixing base2 tests 35aedfd
  • Version bump to release, updating CHANGELOG.md f2e7bde

9.0.5

16 June 2022

9.0.4

16 June 2022

9.0.3

16 June 2022

  • Fixing the base value when using iec standard #153
  • Version bump to release 66b1da5

9.0.2

11 June 2022

  • Fix type inference for output: 'array' when precision is configured #151
  • Updating CHANGELOG.md 04542c6
  • Building for new banner 3ff8295
  • Updating CHANGELOG.md 6bd0ee0

9.0.1

1 June 2022

  • Updating the signature to use destructuring, removing edge case assignments on invalid inputs (fail by design) a833bb5
  • Removing more defaults from test 3c6bcb5

9.0.0

26 May 2022

  • Fixing output #149
  • Updating dependencies, version bump to release 6284219
  • Updating CHANGELOG.md 1223f8d
  • Removing unix option, fixing assignment of standard & updating tests 3eb5bb2

8.0.7

19 January 2022

  • [typescript] Add pad, precision, & roundingMethod #145
  • Fixing a duplicate declaration within filesize.d.ts from recent merge, building, updating copyright years, & version bump to release 2dbc4bc

8.0.6

31 October 2021

  • Updating dependencies, fixing test:unit, building to update version in lib/**, updating CHANGELOG.md, version bump to release b6628f8

8.0.5

27 October 2021

  • Fixing type comments of base and standard #143
  • Updating CHANGELOG.md, version bump to release bec8e12

8.0.4

27 October 2021

  • feat: infer result type correctly with TypeScript (no "npx tsc") #144
  • feat: infer result type correctly with TypeScript #142
  • Updating CHANGELOG.md, version bump to release ef24fdc
  • Revert "Merge pull request #142 from tomoto/feat/infer-result-type-with-typescript" 2b2d508

8.0.3

13 September 2021

  • Revert "Fixing assignment of standard such that it aligns with the README (default of "iec") & updating tests, fixing hardcoded copyright year in rollup.config.js, version bump to release" afd78c2
  • Updating CHANGELOG.md 68aeed5

8.0.2

12 September 2021

  • Version bump to release, updating dependencies 9a1fd51
  • Updating CHANGELOG.md 5024749
  • SI is not a symbol family, it's a synonym for 'base: 10' 44d8bc9

8.0.1

12 September 2021

  • Fixing assignment of standard such that it aligns with the README (default of "iec") & updating tests, fixing hardcoded copyright year in rollup.config.js, version bump to release bb72429

8.0.0

18 August 2021

  • Make SI and IEC standards defaults #138
  • Update symbols for bits to "bit" #136
  • Make SI and IEC standards defaults #137
  • Updating lock file, updating changelog, version bump to release & building outputs 9633cda
  • Updating CHANGELOG.md f89b102

7.0.0

11 July 2021

  • Build an ES6 module as well #134
  • Updating CHANGELOG.md 713000e
  • Updating dev dependencies, major version bump to release new module value in package.json, adding .esm files in /lib 4c4363a

6.4.0

29 June 2021

  • Precision option #133
  • Implementing precision option with tests, fixes #117, fixes #132 #117 #132
  • Updating README.md & dev dependencies 8ec6429
  • Version bump to release d431869
  • Updating CHANGELOG.md 0f4cf40

6.3.0

21 April 2021

  • [feature suggestion] add roundingMethod option #131
  • add roundingMethod option f2acf64
  • Version bump to release roundingMethod option 26735f6
  • Updating CHANGELOG.md e1448a6

6.2.6

19 April 2021

  • Fixing missing unit on object output when input is 0 72c5736
  • Updating CHANGELOG.md 75c2445

6.2.5

15 April 2021

  • Removing the multiple return statements from the end of filesize(), tweaking order of final changes 1d19261
  • Updating CHANGELOG.md ae2c8f9

6.2.4

15 April 2021

  • Fixing late application of pad 6c1d2cb
  • Updating travis-ci.org 8878747

6.2.3

15 April 2021

  • Updating dependencies, updating bannerShort in rollup.config.js 86b4374
  • Updating CHANGELOG.md 493e759
  • Fixing README.md f6667c8

6.2.2

13 April 2021

  • Small package cleanup #130
  • Remove support for bower 51d4eb6
  • Remove support for composer/packagist 90b3e28
  • Remove .npmignore e6bc23d

6.2.1

13 April 2021

  • Adding unit to object output #129
  • Fixing array output such that fullform is a potential output #128
  • Adding pad optional setting to pad the ending of decimal place #127
  • Adding pad optional setting to pad the ending of decimal place, fixes #117 #117
  • Version bump to release 98a59b1

6.2.0

13 April 2021

  • Replace build system with rollup #124
  • Updating copyright years in LICENSE & README.md, version bump to signal new build tool chain 098538d
  • Upgrade babel to version 7 26d7a75
  • Remove grunt 5faab68

6.1.0

21 February 2020

  • Adding exponent to object output, fixes #112 #113
  • Merge pull request #113 from avoidwork/exponents #112
  • Adding exponent to object output, fixes #112 #112
  • Using auto-changelog to generate a formatted changelog, fixes #110 #110
  • Updating CHANGELOG d1b726a
  • Updating LICENSE 8acef4c
  • Create FUNDING.yml 6eb9744

6.0.1

8 November 2019

  • Fixing a regression due to 5.x revert, fixes #111 #111
  • Updating CHANGELOG 48b7e40

6.0.0

30 October 2019

  • Create FUNDING.yml #106
  • Revert "Fixing the hackish type definition, fixes #105" #105
  • Revert "Merge pull request #104 from avoidwork/modernize" 3909b04
  • Reverting modern build as it's too problematic at this time, major version bump to roll forward 71a9ead
  • Revert "Merge pull request #106 from avoidwork/avoidwork-patch-1" ec99f00

5.0.3

8 October 2019

5.0.2

7 October 2019

  • git-log based CHANGELOG via npm run changelog d8415f5
  • Adding CHANGELOG to .npmignore with minor version bump to prep for changes 2a9e78d

5.0.1

30 September 2019

  • Fixing the hackish type definition, fixes #105 #105

5.0.0

30 September 2019

  • Modernizing build & outputs #104
  • Updating .npmignore 5715622
  • Updating typescript module definition 2e3d1bb

4.2.1

25 September 2019

  • Fixing case where rounding results in the wrong exponent, fixes #103 #103
  • Updating travis-ci.org config 5b362af

4.2.0

11 September 2019

  • Add support for localeOptions option: allow customization of i18n output #102
  • Bump mixin-deep from 1.3.1 to 1.3.2 #101
  • Bump eslint-utils from 1.3.1 to 1.4.2 #99
  • Updating dependencies, version bump to release #102 ab80f87
  • add support for localeOptions 6505945
  • build b9f7fb4

4.1.2

15 February 2019

  • Refactoring locale option to accept String or Boolean values, re-organizing code such that an exponent output skips unneeded ops dd8f754

4.1.1

13 February 2019

  • Fixing order of ops that could've impacted object output 3b71615

4.1.0

14 February 2019

  • Adding locale option which overrides separator, fixes #96 #96

4.0.0

12 January 2019

  • Removing deprecated suffixes option with a major version bump, updating README & LICENSE copyrights, updating dev dependencies a0b268f
  • Updating README 81e5499
  • Updating travis-ci.org configuration 5bcc3c4

3.6.1

24 March 2018

  • Including ES6 version with npm install, updating grunt build such that more files are linted fb9bd3e
  • oops dc04050

3.6.0

3 February 2018

  • Adding separator option, fixes #93 #93

3.5.11

18 October 2017

  • Add CDNJS version badge in README.md #90
  • Updating build dependencies, travis-ci.org config, fixing banner alignment in uglify output 20baedd

3.5.10

19 May 2017

3.5.9

30 April 2017

  • Removing loader script as it apparently breaks browserify/webpack loading (sigh) 54d9770

3.5.8

29 April 2017

  • Adding index.js to load es5 or es6 depending on the test environment 0e07bba

3.5.7

29 April 2017

  • Adding babili task to minify the es6 file, fixes #86 #86

3.5.6

6 March 2017

  • Building missing files, updating README 77db546

3.5.5

24 February 2017

  • Changing things such that you can do filesize(0, {exponent: n}) and get the correct result, adding a test, fixes #85 #85
  • Updating example in README 7c75121
  • Updating example in README 1f6c51f

3.5.4

24 January 2017

  • Adding fullforms for overriding full form 727db07

3.5.3

24 January 2017

3.5.2

24 January 2017

3.5.1

24 January 2017

  • Correcting longform to fullform 1dee34f

3.5.0

24 January 2017

  • Adding longform flag, fixing markdown in README 7d8b650

3.4.3

23 January 2017

  • Oops, fixes #84 #84

3.4.2

21 January 2017

  • Simplifying filesize.partial() & adding a test 4d1e9ea

3.4.1

19 January 2017

  • Changing a statement to be a little easier to read, updating build status graphic to be SVG for better rendering on various devices de2e388
  • Updating travis-ci.org config 'cause the eslint dep requires es6 engine without a strictEngine (so pro) c1d40b5
  • Fixing alignment of the example in README 245aa6d

3.4.0

19 January 2017

  • improve format #83
  • Creating filesize.partial() for creating a partial application / functional programming style, updating dependencies, fixing lint errors, updating README & LICENSE copyright year, updating README to cover filesize.partial() 1ba7b0c
  • Adding a downloads shield to the README ... 'cause why not 81bc1d2

3.3.0

23 April 2016

  • Adding support for IEC standard via new standard descriptor property (defaults to jedec), fixes #80 #80
  • Handling bits, and base collision 70048cb
  • Minor optimization by looking at the exponent vs the string length d795026
  • Updating a comment 0521336

3.2.1

30 January 2016

  • add test case for huge number #76
  • Fixing invalid results for small & large bit values, fixes #77 #77

3.2.0

22 January 2016

  • Fixing a poor choice in wording by marking suffixes for deprecation & moving to symbols, updating README (fixes #72, #73) #72

3.1.6

19 January 2016

  • Fixing kilobit & kilobyte symbols by ensuring JEDEC for base 2 & SI for base 10, fixes #69 #69
  • Removing .idea file from npm, fixes #71 #71
  • Updating travis-ci to test node 5.4.x df5d39d

3.1.5

22 December 2015

  • Add bower manifest #67
  • Fixing bit suffix & updating build to use latest version of babel, fixes #68 #68
  • Fixing package.json 71cc5a5

3.1.4

13 November 2015

  • Correctly check for AMD loader #66
  • Version bump d60a6e2

3.1.3

27 July 2015

  • Update license attribute #63
  • Updating the package manifest for npm 20b4ac4

3.1.2

27 February 2015

  • Removing unneeded nesting of conditionals a4448cd

3.1.1

24 February 2015

  • Updating to transpiler to babel 4.0.0, reformatting some statements for readability, moving consts to the top of the lib fc3714f
  • Updating travis file 4fd4373

3.1.0

4 February 2015

  • Add a Gitter chat badge to README.md #60
  • Refactored to ES6, with transpiling to ES5 f214346
  • Update README.md db1df8e
  • Added Gitter badge 905c6b5

3.0.2

29 January 2015

  • Fixing an error in exponent calculation such that ceil is utilized & added two tests, fixes #59 #59

3.0.1

12 January 2015

  • Adding the ability to specify the exponent used for determining the file size, and adding exponent as an output value (feature request by email) 0af5ea1

3.0.0

4 January 2015

  • Composer support #58
  • Refactoring filesize() to output Array & Object shapes, & changing default base to 2, reformatting code based on IDE settings (not included) a7fe91b
  • add composer.json f53152d

2.0.4

2 October 2014

  • Fixes #55 by avoiding type mutation, fixing CI tests by removing node 0.8.x #55

2.0.3

28 February 2014

  • Minor change #53
  • Adding exabyte, zettabyte, yottabyte, exabit, zettabit, & yottabit sizes fd448ab

2.0.2

28 February 2014

  • Removing a file #52
  • Optimizations #51
  • Changing the method of generating result 98f34a1
  • Generating a String instead of an Array for 'unix mode' 7e46fd9

2.0.1

24 February 2014

  • Adding language overriding via optional suffixes dictionary #49

2.0.0

12 October 2013

1.10.0

19 July 2013

1.9.7

8 July 2013

  • Fixing scientific notation (google!), fixes #39 #39

1.9.6

5 July 2013

  • Minor fix #38
  • Correcting kilobit & kilobyte symbols 223b8ea

1.9.5

18 June 2013

  • Updating README #37
  • Updating .npmignore #36

1.9.4

13 June 2013

  • Minor change #35
  • Updating README.md examples #34
  • Refactoring #33
  • Updated grunt build, implemented jshint for linting, fixes #32 #32
  • Removing unused grunt module 11f0d72
  • Returning grunt-cli to package.json 191baa4

1.9.3

14 April 2013

1.9.2

11 April 2013

  • Minor fix #30
  • Treating bytes as cardinal numbers fdf8b22

1.9.1

7 April 2013

  • Minor change #29
  • Updating README.md #27
  • Updating .npmignore to ignore unneeded files for distribution, fixes #28 #28

1.9.0

7 April 2013

  • API change #26
  • Added a third optional boolean argument to disable bit sizes, fixes #25 #25

1.8.0

3 March 2013

  • Optimizations #24
  • Caching variables in closure scope, upgraded to grunt 0.4.0, fixed license link in README.md 7648fee

1.7.9

5 February 2013

  • Minor change #20
  • Changing how 0 is handled (less wasted ops) d1428f6

1.7.8

5 February 2013

  • Minor refactoring #19
  • Adding support for zero as a parameter 5075979

1.7.7

5 February 2013

  • Optimizations #18
  • Optimizations; kudos to @marktucker for looking over the lib e5965f0
  • :gem: Added travis.yml file :gem: 785ae92

1.7.6

5 February 2013

  • Minor optimization #17
  • Optimizing the negative number flip using the simplest method (minus operator) 0fb401c

1.7.5

2 February 2013

  • Fixing license link in banner #16
  • One last change #15
  • Removing unnecessary typeof operators 3f347fa

1.7.4

2 February 2013

  • Minor changes #14
  • Utilizing Math.abs(), updating the banner fb27fd3

1.7.3

2 February 2013

  • Minor refactoring #13
  • Adding support for negative sizes, fixes #12 #12
  • Adding license for proper attribution in a retail product e1a3ea5
  • Adding license for proper attribution in a retail product 4a167c2

1.7.2

2 November 2012

  • Minor changes #11
  • Refactored to utilize regex tests instead of string comparisons, minor version bump bfa1398

1.7.1

2 November 2012

1.7.0

2 November 2012

  • Refactored #9
  • Extended size ranges to support Byte - PetaByte based on the new standard definitions 97a497c
  • Version bump 5341f0b

1.6.7

2 November 2012

  • Minor refactoring #8
  • The repo your repo could be like! #7
  • Specified the base/radix for parseInt() & simplified the number cast 8315027
  • Fixing a test f487a26
  • :gem: Added travis.yml file :gem: 497a6f9

1.6.6

15 August 2012

  • Shouldn't have been in the commit #6
  • Correcting dir structure #5
  • Implemented a grunt build process & unit tests #4
  • Removing deprecated variables, moving tag 6cfdca0
  • Fixing npm path cc36eac
  • Updating npm package.json, moving tag ce70843

1.6.5

22 June 2012

  • Add a jam ignore to reduce packaged size #3
  • Made it faster f2126d0
  • Removing unnecessary ops, making the AMD loading anonymous, updated docblock cf2c698
  • Generated a proper package.json 59d04ab

1.6.0

2 May 2012

1.5.0

30 April 2012

  • Added an optional third boolean parameter to emulate "ls -lh" output, which overrides "pos" parameter 33b074c

1.4.0

16 March 2012

  • Add parameter validation, fixed byte output, updated docblock 329e874
  • Removing window references 1375bdc
  • Fixing AMD loading 21e2aa7

1.3.0

8 March 2012

1.2.0

4 March 2012

1.1.0

2 March 2012

  • Added 'byte' as the smallest size, fixes S3 file size computing, etc. 829b250
  • Updated README 11f5015

1.0.0

2 March 2012