Skip to content

Commit cb5d673

Browse files
committed
Fixing a regression due to 5.x revert, fixes #111
1 parent 48b7e40 commit cb5d673

8 files changed

+114
-9
lines changed

filesize.d.ts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// Type definitions for filesize 6.0.1
2+
// Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com
3+
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
4+
// Renaud Chaput <https://github.com/renchap>
5+
// Roman Nuritdinov <https://github.com/Ky6uk>
6+
// Sam Hulick <https://github.com/ffxsam>
7+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8+
9+
declare var fileSize: Filesize.Filesize;
10+
export = fileSize;
11+
export as namespace filesize;
12+
13+
declare namespace Filesize {
14+
interface SiJedecBits {
15+
b?: string;
16+
Kb?: string;
17+
Mb?: string;
18+
Gb?: string;
19+
Tb?: string;
20+
Pb?: string;
21+
Eb?: string;
22+
Zb?: string;
23+
Yb?: string;
24+
}
25+
26+
interface SiJedecBytes {
27+
B?: string;
28+
KB?: string;
29+
MB?: string;
30+
GB?: string;
31+
TB?: string;
32+
PB?: string;
33+
EB?: string;
34+
ZB?: string;
35+
YB?: string;
36+
}
37+
38+
type SiJedec = SiJedecBits & SiJedecBytes & { [name: string]: string };
39+
40+
interface Options {
41+
/**
42+
* Number base, default is 2
43+
*/
44+
base?: number;
45+
/**
46+
* Enables bit sizes, default is false
47+
*/
48+
bits?: boolean;
49+
/**
50+
* Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1
51+
*/
52+
exponent?: number;
53+
/**
54+
* Enables full form of unit of measure, default is false
55+
*/
56+
fullform?: boolean;
57+
/**
58+
* Array of full form overrides, default is []
59+
*/
60+
fullforms?: string[];
61+
/**
62+
* BCP 47 language tag to specify a locale, or true to use default locale, default is ""
63+
*/
64+
locale?: string | boolean;
65+
/**
66+
* ECMA-402 number format option overrides, default is "{}"
67+
*/
68+
localeOptions?: Intl.NumberFormatOptions;
69+
/**
70+
* Output of function (array, exponent, object, or string), default is string
71+
*/
72+
output?: "array" | "exponent" | "object" | "string";
73+
/**
74+
* Decimal place, default is 2
75+
*/
76+
round?: number;
77+
/**
78+
* Decimal separator character, default is `.`
79+
*/
80+
separator?: string;
81+
/**
82+
* Character between the result and suffix, default is ` `
83+
*/
84+
spacer?: string;
85+
/**
86+
* Standard unit of measure, can be iec or jedec, default is jedec; can be overruled by base
87+
*/
88+
standard?: "iec" | "jedec";
89+
/**
90+
* Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found
91+
*/
92+
symbols?: SiJedec;
93+
/**
94+
* Enables unix style human readable output, e.g ls -lh, default is false
95+
*/
96+
unix?: boolean;
97+
}
98+
99+
interface Filesize {
100+
(bytes: number, options?: Options): string;
101+
partial: (options: Options) => ((bytes: number) => string);
102+
}
103+
}

lib/filesize.es6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @copyright 2019 Jason Mulligan <[email protected]>
55
* @license BSD-3-Clause
6-
* @version 6.0.0
6+
* @version 6.0.1
77
*/
88
(function (global) {
99
const b = /^(b|B)$/,

lib/filesize.es6.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/filesize.es6.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/filesize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* @copyright 2019 Jason Mulligan <[email protected]>
77
* @license BSD-3-Clause
8-
* @version 6.0.0
8+
* @version 6.0.1
99
*/
1010
(function (global) {
1111
var b = /^(b|B)$/,

lib/filesize.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "filesize",
33
"description": "JavaScript library to generate a human readable String describing the file size",
4-
"version": "6.0.0",
4+
"version": "6.0.1",
55
"homepage": "https://filesizejs.com",
66
"author": "Jason Mulligan <[email protected]>",
77
"repository": {
@@ -16,7 +16,9 @@
1616
"*.d.ts"
1717
],
1818
"license": "BSD-3-Clause",
19-
"main": "lib/filesize",
19+
"browser": "lib/filesize.min.js",
20+
"main": "lib/filesize.js",
21+
"types": "filesize.d.ts",
2022
"engines": {
2123
"node": ">= 0.4.0"
2224
},

0 commit comments

Comments
 (0)