Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filesize

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filesize - npm Package Compare versions

Comparing version 9.0.2 to 9.0.4

6

lib/filesize.es6.js

@@ -6,3 +6,3 @@ /**

* @license BSD-3-Clause
* @version 9.0.2
* @version 9.0.4
*/

@@ -51,2 +51,6 @@ (function (global, factory) {

u = "";
// Sync base & standard
base = standard === "iec" ? 10 : 2;
const ceil = base === 10 ? 1000 : 1024,

@@ -53,0 +57,0 @@ full = fullform === true,

4

lib/filesize.es6.min.js
/*!
2022 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 9.0.2
@version 9.0.4
*/
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";const i={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}},t={ceil:Math.ceil,floor:Math.floor,round:Math.round};function e(e,{bits:o=!1,pad:n=!1,base:b=10,round:l=2,locale:r="",localeOptions:s={},separator:a="",spacer:f=" ",symbols:u={},standard:c="iec",output:p="string",fullform:d=!1,fullforms:g=[],exponent:y=-1,roundingMethod:B="round",precision:h=0}={}){let m=y,M=Number(e),x=[],T=0,E="";const N=10===b?1e3:1024,j=!0===d,w=M<0,P=t[B];if(isNaN(e))throw new TypeError("Invalid number");if(w&&(M=-M),(-1===m||isNaN(m))&&(m=Math.floor(Math.log(M)/Math.log(N)),m<0&&(m=0)),m>8&&(h>0&&(h+=8-m),m=8),"exponent"===p)return m;if(0===M)x[0]=0,E=x[1]=i.symbol[c][o?"bits":"bytes"][m];else{T=M/(2===b?Math.pow(2,10*m):Math.pow(1e3,m)),o&&(T*=8,T>=N&&m<8&&(T/=N,m++));const t=Math.pow(10,m>0?l:0);x[0]=P(T*t)/t,x[0]===N&&m<8&&-1===y&&(x[0]=1,m++),E=x[1]=i.symbol[c][o?"bits":"bytes"][m]}if(w&&(x[0]=-x[0]),h>0&&(x[0]=x[0].toPrecision(h)),x[1]=u[x[1]]||x[1],!0===r?x[0]=x[0].toLocaleString():r.length>0?x[0]=x[0].toLocaleString(r,s):a.length>0&&(x[0]=x[0].toString().replace(".",a)),n&&!1===Number.isInteger(x[0])&&l>0){const i=a||".",t=x[0].toString().split(i),e=t[1]||"",o=e.length,n=l-o;x[0]=`${t[0]}${i}${e.padEnd(o+n,"0")}`}return j&&(x[1]=g[m]?g[m]:i.fullform[c][m]+(o?"bit":"byte")+(1===x[0]?"":"s")),"array"===p?x:"object"===p?{value:x[0],symbol:x[1],exponent:m,unit:E}:x.join(f)}return e.partial=i=>t=>e(t,i),e}));
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";const i={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}},t={ceil:Math.ceil,floor:Math.floor,round:Math.round};function e(e,{bits:o=!1,pad:n=!1,base:b=10,round:l=2,locale:r="",localeOptions:s={},separator:a="",spacer:f=" ",symbols:u={},standard:c="iec",output:p="string",fullform:d=!1,fullforms:g=[],exponent:y=-1,roundingMethod:B="round",precision:h=0}={}){let m=y,M=Number(e),x=[],T=0,E="";const N=10===(b="iec"===c?10:2)?1e3:1024,j=!0===d,w=M<0,P=t[B];if(isNaN(e))throw new TypeError("Invalid number");if(w&&(M=-M),(-1===m||isNaN(m))&&(m=Math.floor(Math.log(M)/Math.log(N)),m<0&&(m=0)),m>8&&(h>0&&(h+=8-m),m=8),"exponent"===p)return m;if(0===M)x[0]=0,E=x[1]=i.symbol[c][o?"bits":"bytes"][m];else{T=M/(2===b?Math.pow(2,10*m):Math.pow(1e3,m)),o&&(T*=8,T>=N&&m<8&&(T/=N,m++));const t=Math.pow(10,m>0?l:0);x[0]=P(T*t)/t,x[0]===N&&m<8&&-1===y&&(x[0]=1,m++),E=x[1]=i.symbol[c][o?"bits":"bytes"][m]}if(w&&(x[0]=-x[0]),h>0&&(x[0]=x[0].toPrecision(h)),x[1]=u[x[1]]||x[1],!0===r?x[0]=x[0].toLocaleString():r.length>0?x[0]=x[0].toLocaleString(r,s):a.length>0&&(x[0]=x[0].toString().replace(".",a)),n&&!1===Number.isInteger(x[0])&&l>0){const i=a||".",t=x[0].toString().split(i),e=t[1]||"",o=e.length,n=l-o;x[0]=`${t[0]}${i}${e.padEnd(o+n,"0")}`}return j&&(x[1]=g[m]?g[m]:i.fullform[c][m]+(o?"bit":"byte")+(1===x[0]?"":"s")),"array"===p?x:"object"===p?{value:x[0],symbol:x[1],exponent:m,unit:E}:x.join(f)}return e.partial=i=>t=>e(t,i),e}));
//# sourceMappingURL=filesize.es6.min.js.map

@@ -6,3 +6,3 @@ /**

* @license BSD-3-Clause
* @version 9.0.2
* @version 9.0.4
*/

@@ -45,2 +45,6 @@ const strings = {

u = "";
// Sync base & standard
base = standard === "iec" ? 10 : 2;
const ceil = base === 10 ? 1000 : 1024,

@@ -47,0 +51,0 @@ full = fullform === true,

/*!
2022 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 9.0.2
@version 9.0.4
*/
const t={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}},i={ceil:Math.ceil,floor:Math.floor,round:Math.round};function e(e,{bits:o=!1,pad:b=!1,base:r=10,round:a=2,locale:n="",localeOptions:l={},separator:s="",spacer:c=" ",symbols:p={},standard:u="iec",output:B="string",fullform:f=!1,fullforms:g=[],exponent:d=-1,roundingMethod:h="round",precision:m=0}={}){let y=d,M=Number(e),x=[],E=0,N="";const w=10===r?1e3:1024,P=!0===f,T=M<0,j=i[h];if(isNaN(e))throw new TypeError("Invalid number");if(T&&(M=-M),(-1===y||isNaN(y))&&(y=Math.floor(Math.log(M)/Math.log(w)),y<0&&(y=0)),y>8&&(m>0&&(m+=8-y),y=8),"exponent"===B)return y;if(0===M)x[0]=0,N=x[1]=t.symbol[u][o?"bits":"bytes"][y];else{E=M/(2===r?Math.pow(2,10*y):Math.pow(1e3,y)),o&&(E*=8,E>=w&&y<8&&(E/=w,y++));const i=Math.pow(10,y>0?a:0);x[0]=j(E*i)/i,x[0]===w&&y<8&&-1===d&&(x[0]=1,y++),N=x[1]=t.symbol[u][o?"bits":"bytes"][y]}if(T&&(x[0]=-x[0]),m>0&&(x[0]=x[0].toPrecision(m)),x[1]=p[x[1]]||x[1],!0===n?x[0]=x[0].toLocaleString():n.length>0?x[0]=x[0].toLocaleString(n,l):s.length>0&&(x[0]=x[0].toString().replace(".",s)),b&&!1===Number.isInteger(x[0])&&a>0){const t=s||".",i=x[0].toString().split(t),e=i[1]||"",o=e.length,b=a-o;x[0]=`${i[0]}${t}${e.padEnd(o+b,"0")}`}return P&&(x[1]=g[y]?g[y]:t.fullform[u][y]+(o?"bit":"byte")+(1===x[0]?"":"s")),"array"===B?x:"object"===B?{value:x[0],symbol:x[1],exponent:y,unit:N}:x.join(c)}e.partial=t=>i=>e(i,t);export{e as default};
const t={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}},i={ceil:Math.ceil,floor:Math.floor,round:Math.round};function e(e,{bits:o=!1,pad:b=!1,base:r=10,round:a=2,locale:n="",localeOptions:l={},separator:s="",spacer:c=" ",symbols:p={},standard:u="iec",output:B="string",fullform:f=!1,fullforms:g=[],exponent:d=-1,roundingMethod:h="round",precision:m=0}={}){let y=d,M=Number(e),x=[],E=0,N="";const w=10===(r="iec"===u?10:2)?1e3:1024,P=!0===f,T=M<0,j=i[h];if(isNaN(e))throw new TypeError("Invalid number");if(T&&(M=-M),(-1===y||isNaN(y))&&(y=Math.floor(Math.log(M)/Math.log(w)),y<0&&(y=0)),y>8&&(m>0&&(m+=8-y),y=8),"exponent"===B)return y;if(0===M)x[0]=0,N=x[1]=t.symbol[u][o?"bits":"bytes"][y];else{E=M/(2===r?Math.pow(2,10*y):Math.pow(1e3,y)),o&&(E*=8,E>=w&&y<8&&(E/=w,y++));const i=Math.pow(10,y>0?a:0);x[0]=j(E*i)/i,x[0]===w&&y<8&&-1===d&&(x[0]=1,y++),N=x[1]=t.symbol[u][o?"bits":"bytes"][y]}if(T&&(x[0]=-x[0]),m>0&&(x[0]=x[0].toPrecision(m)),x[1]=p[x[1]]||x[1],!0===n?x[0]=x[0].toLocaleString():n.length>0?x[0]=x[0].toLocaleString(n,l):s.length>0&&(x[0]=x[0].toString().replace(".",s)),b&&!1===Number.isInteger(x[0])&&a>0){const t=s||".",i=x[0].toString().split(t),e=i[1]||"",o=e.length,b=a-o;x[0]=`${i[0]}${t}${e.padEnd(o+b,"0")}`}return P&&(x[1]=g[y]?g[y]:t.fullform[u][y]+(o?"bit":"byte")+(1===x[0]?"":"s")),"array"===B?x:"object"===B?{value:x[0],symbol:x[1],exponent:y,unit:N}:x.join(c)}e.partial=t=>i=>e(i,t);export{e as default};
//# sourceMappingURL=filesize.esm.min.js.map

@@ -6,3 +6,3 @@ /**

* @license BSD-3-Clause
* @version 9.0.2
* @version 9.0.4
*/

@@ -84,3 +84,5 @@ (function (global, factory) {

val = 0,
u = "";
u = ""; // Sync base & standard
base = standard === "iec" ? 10 : 2;
var ceil = base === 10 ? 1000 : 1024,

@@ -87,0 +89,0 @@ full = fullform === true,

/*!
2022 Jason Mulligan <jason.mulligan@avoidwork.com>
@version 9.0.2
@version 9.0.4
*/
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";var i={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}},t={ceil:Math.ceil,floor:Math.floor,round:Math.round};function e(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=o.bits,r=void 0!==n&&n,b=o.pad,a=void 0!==b&&b,l=o.base,d=void 0===l?10:l,s=o.round,f=void 0===s?2:s,u=o.locale,c=void 0===u?"":u,p=o.localeOptions,v=void 0===p?{}:p,g=o.separator,h=void 0===g?"":g,y=o.spacer,B=void 0===y?" ":y,m=o.symbols,M=void 0===m?{}:m,x=o.standard,T=void 0===x?"iec":x,E=o.output,N=void 0===E?"string":E,j=o.fullform,w=void 0!==j&&j,P=o.fullforms,G=void 0===P?[]:P,K=o.exponent,S=void 0===K?-1:K,Y=o.roundingMethod,Z=void 0===Y?"round":Y,z=o.precision,k=void 0===z?0:z,I=S,L=Number(e),O=[],q=0,A="",C=10===d?1e3:1024,D=!0===w,F=L<0,H=t[Z];if(isNaN(e))throw new TypeError("Invalid number");if(F&&(L=-L),(-1===I||isNaN(I))&&(I=Math.floor(Math.log(L)/Math.log(C)))<0&&(I=0),I>8&&(k>0&&(k+=8-I),I=8),"exponent"===N)return I;if(0===L)O[0]=0,A=O[1]=i.symbol[T][r?"bits":"bytes"][I];else{q=L/(2===d?Math.pow(2,10*I):Math.pow(1e3,I)),r&&(q*=8)>=C&&I<8&&(q/=C,I++);var J=Math.pow(10,I>0?f:0);O[0]=H(q*J)/J,O[0]===C&&I<8&&-1===S&&(O[0]=1,I++),A=O[1]=i.symbol[T][r?"bits":"bytes"][I]}if(F&&(O[0]=-O[0]),k>0&&(O[0]=O[0].toPrecision(k)),O[1]=M[O[1]]||O[1],!0===c?O[0]=O[0].toLocaleString():c.length>0?O[0]=O[0].toLocaleString(c,v):h.length>0&&(O[0]=O[0].toString().replace(".",h)),a&&!1===Number.isInteger(O[0])&&f>0){var Q=h||".",R=O[0].toString().split(Q),U=R[1]||"",V=U.length,W=f-V;O[0]="".concat(R[0]).concat(Q).concat(U.padEnd(V+W,"0"))}return D&&(O[1]=G[I]?G[I]:i.fullform[T][I]+(r?"bit":"byte")+(1===O[0]?"":"s")),"array"===N?O:"object"===N?{value:O[0],symbol:O[1],exponent:I,unit:A}:O.join(B)}return e.partial=function(i){return function(t){return e(t,i)}},e}));
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(i="undefined"!=typeof globalThis?globalThis:i||self).filesize=t()}(this,(function(){"use strict";var i={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}},t={ceil:Math.ceil,floor:Math.floor,round:Math.round};function e(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=o.bits,r=void 0!==n&&n,b=o.pad,a=void 0!==b&&b,l=o.base,d=void 0===l?10:l,s=o.round,f=void 0===s?2:s,u=o.locale,c=void 0===u?"":u,p=o.localeOptions,v=void 0===p?{}:p,g=o.separator,h=void 0===g?"":g,y=o.spacer,B=void 0===y?" ":y,m=o.symbols,M=void 0===m?{}:m,x=o.standard,T=void 0===x?"iec":x,E=o.output,N=void 0===E?"string":E,j=o.fullform,w=void 0!==j&&j,P=o.fullforms,G=void 0===P?[]:P,K=o.exponent,S=void 0===K?-1:K,Y=o.roundingMethod,Z=void 0===Y?"round":Y,z=o.precision,k=void 0===z?0:z,I=S,L=Number(e),O=[],q=0,A="",C=10===(d="iec"===T?10:2)?1e3:1024,D=!0===w,F=L<0,H=t[Z];if(isNaN(e))throw new TypeError("Invalid number");if(F&&(L=-L),(-1===I||isNaN(I))&&(I=Math.floor(Math.log(L)/Math.log(C)))<0&&(I=0),I>8&&(k>0&&(k+=8-I),I=8),"exponent"===N)return I;if(0===L)O[0]=0,A=O[1]=i.symbol[T][r?"bits":"bytes"][I];else{q=L/(2===d?Math.pow(2,10*I):Math.pow(1e3,I)),r&&(q*=8)>=C&&I<8&&(q/=C,I++);var J=Math.pow(10,I>0?f:0);O[0]=H(q*J)/J,O[0]===C&&I<8&&-1===S&&(O[0]=1,I++),A=O[1]=i.symbol[T][r?"bits":"bytes"][I]}if(F&&(O[0]=-O[0]),k>0&&(O[0]=O[0].toPrecision(k)),O[1]=M[O[1]]||O[1],!0===c?O[0]=O[0].toLocaleString():c.length>0?O[0]=O[0].toLocaleString(c,v):h.length>0&&(O[0]=O[0].toString().replace(".",h)),a&&!1===Number.isInteger(O[0])&&f>0){var Q=h||".",R=O[0].toString().split(Q),U=R[1]||"",V=U.length,W=f-V;O[0]="".concat(R[0]).concat(Q).concat(U.padEnd(V+W,"0"))}return D&&(O[1]=G[I]?G[I]:i.fullform[T][I]+(r?"bit":"byte")+(1===O[0]?"":"s")),"array"===N?O:"object"===N?{value:O[0],symbol:O[1],exponent:I,unit:A}:O.join(B)}return e.partial=function(i){return function(t){return e(t,i)}},e}));
//# sourceMappingURL=filesize.min.js.map
{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "9.0.2",
"version": "9.0.4",
"homepage": "https://filesizejs.com",

@@ -36,11 +36,11 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>",

"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/core": "^7.18.5",
"@babel/preset-env": "^7.18.2",
"auto-changelog": "^2.4.0",
"eslint": "^8.16.0",
"eslint": "^8.17.0",
"nodeunit-x": "^0.15.0",
"rollup": "^2.75.5",
"rollup": "^2.75.6",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.7.2"
"typescript": "^4.7.3"
},

@@ -47,0 +47,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc