From bc34e1dbe51bbde362a01cef1319f9d1dcd6f193 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 19 Sep 2025 20:59:54 -0400 Subject: [PATCH 1/2] Updating README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 952e833..1b0dadb 100644 --- a/README.md +++ b/README.md @@ -343,7 +343,7 @@ filesize(265318, {standard: "jedec"}); // "259.1 KB" ```javascript filesize(500, {bits: true}); // "4 kbit" filesize(1024, {bits: true}); // "8.19 kbit" -filesize(1024, {bits: true, base: 2}); // "8 kibit" +filesize(1024, {bits: true, base: 2}); // "8 Kibit" ``` ### Custom Formatting @@ -351,7 +351,7 @@ filesize(1024, {bits: true, base: 2}); // "8 kibit" ```javascript // Full form units filesize(1024, {fullform: true}); // "1.02 kilobytes" -filesize(1024, {base: 2, fullform: true}); // "1 kibibytes" +filesize(1024, {base: 2, fullform: true}); // "1 kibibyte" // Custom separators and spacing filesize(265318, {separator: ","}); // "265,32 kB" @@ -386,7 +386,7 @@ filesize(1024, {exponent: 1}); // "1.02 kB" filesize(BigInt(1024), {standard: "jedec"}); // "1 KB" // Extreme precision for very large numbers -filesize(Math.pow(1024, 8), {precision: 3}); // "1208925819614629174706176 YB" +filesize(Math.pow(1024, 8), {precision: 3}); // "1.21 YB" ``` ### Partial Application Patterns From cc9e109fda32f5949c4315b752c7d6baa5393482 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Fri, 19 Sep 2025 21:02:08 -0400 Subject: [PATCH 2/2] Version bump --- CHANGELOG.md | 7 +++++++ dist/filesize.cjs | 2 +- dist/filesize.js | 2 +- dist/filesize.min.js | 2 +- dist/filesize.umd.js | 2 +- dist/filesize.umd.min.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d46a304..1b485ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [11.0.10](https://github.com/avoidwork/filesize.js/compare/11.0.9...11.0.10) + +- Updating README.md [`bc34e1d`](https://github.com/avoidwork/filesize.js/commit/bc34e1dbe51bbde362a01cef1319f9d1dcd6f193) + #### [11.0.9](https://github.com/avoidwork/filesize.js/compare/11.0.8...11.0.9) +> 19 September 2025 + - Optimizations [`#206`](https://github.com/avoidwork/filesize.js/pull/206) +- Version bump [`6c22783`](https://github.com/avoidwork/filesize.js/commit/6c2278373e9919a834909cf2b74bc9dbb3e742e8) - Updating documentation [`f38cabf`](https://github.com/avoidwork/filesize.js/commit/f38cabf7499a728a65a8ab523b83f9b24eb45187) - Updating documentation [`5d06823`](https://github.com/avoidwork/filesize.js/commit/5d06823ec82d9dc380bc0f9c81e100ce406c00cd) diff --git a/dist/filesize.cjs b/dist/filesize.cjs index f5d3c0b..54ffaf0 100644 --- a/dist/filesize.cjs +++ b/dist/filesize.cjs @@ -3,7 +3,7 @@ * * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 11.0.9 + * @version 11.0.10 */ 'use strict'; diff --git a/dist/filesize.js b/dist/filesize.js index 2ed0bd4..a3572bd 100644 --- a/dist/filesize.js +++ b/dist/filesize.js @@ -3,7 +3,7 @@ * * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 11.0.9 + * @version 11.0.10 */ // Error Messages const INVALID_NUMBER = "Invalid number"; diff --git a/dist/filesize.min.js b/dist/filesize.min.js index 20919ac..2bb7685 100644 --- a/dist/filesize.min.js +++ b/dist/filesize.min.js @@ -1,5 +1,5 @@ /*! 2025 Jason Mulligan - @version 11.0.9 + @version 11.0.10 */ const t="iec",i="jedec",e="bits",o="byte",n="bytes",r="array",l="object",s="string",a="exponent",b="round",p="",u={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"]}},c=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,0x1000000000000000,11805916207174113e5,12089258196146292e8],f=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],d=Math.log(1024),m=Math.log(1e3);function g(g,{bits:y=!1,pad:B=!1,base:h=-1,round:M=2,locale:x="",localeOptions:E={},separator:P="",spacer:j=" ",symbols:T={},standard:w="",output:N=s,fullform:$=!1,fullforms:k=[],exponent:v=-1,roundingMethod:G=b,precision:K=0}={}){let S,Y,Z,O=v,z=Number(g),I=[],L=0,D=p;"si"===w?(S=!0,Y=1e3,Z=i):w===t?(S=!1,Y=1024,Z=t):w===i?(S=!1,Y=1024,Z=i):2===h?(S=!1,Y=1024,Z=t):(S=!0,Y=1e3,Z=i);const q=!0===$,A=z<0,C=Math[G];if("bigint"!=typeof g&&isNaN(g))throw new TypeError("Invalid number");if("function"!=typeof C)throw new TypeError("Invalid rounding method");if(A&&(z=-z),0===z)return I[0]=K>0?(0).toPrecision(K):0,D=I[1]=u.symbol[Z][y?e:n][0],N===a?0:(T[I[1]]&&(I[1]=T[I[1]]),q&&(I[1]=k[0]||u.fullform[Z][0]+(y?"bit":o)),N===r?I:N===l?{value:I[0],symbol:I[1],exponent:0,unit:D}:I.join(j));if((-1===O||isNaN(O))&&(O=S?Math.floor(Math.log(z)/m):Math.floor(Math.log(z)/d),O<0&&(O=0)),O>8&&(K>0&&(K+=8-O),O=8),N===a)return O;let F;F=S?f[O]:c[O],L=z/F,y&&(L*=8,L>=Y&&O<8&&(L/=Y,O++));const H=O>0&&M>0?Math.pow(10,M):1;I[0]=1===H?C(L):C(L*H)/H,I[0]===Y&&O<8&&-1===v&&(I[0]=1,O++),K>0&&(I[0]=I[0].toPrecision(K),I[0].includes("e")&&O<8&&(O++,F=S?f[O]:c[O],L=z/F,I[0]=(1===H?C(L):C(L*H)/H).toPrecision(K)));const J=u.symbol[Z][y?e:n];if(D=I[1]=S&&1===O?y?"kbit":"kB":J[O],A&&(I[0]=-I[0]),T[I[1]]&&(I[1]=T[I[1]]),!0===x?I[0]=I[0].toLocaleString():x.length>0?I[0]=I[0].toLocaleString(x,E):P.length>0&&(I[0]=I[0].toString().replace(".",P)),B&&M>0){const t=I[0].toString(),i=P||(t.match(/(\D)/g)||[]).pop()||".",e=t.split(i),o=e[1]||p,n=o.length,r=M-n;I[0]=`${e[0]}${i}${o.padEnd(n+r,"0")}`}return q&&(I[1]=k[O]||u.fullform[Z][O]+(y?"bit":o)+(1===I[0]?p:"s")),N===r?I:N===l?{value:I[0],symbol:I[1],exponent:O,unit:D}:" "===j?`${I[0]} ${I[1]}`:I.join(j)}function y({bits:t=!1,pad:i=!1,base:e=-1,round:o=2,locale:n="",localeOptions:r={},separator:l="",spacer:a=" ",symbols:p={},standard:u="",output:c=s,fullform:f=!1,fullforms:d=[],exponent:m=-1,roundingMethod:y=b,precision:B=0}={}){return s=>g(s,{bits:t,pad:i,base:e,round:o,locale:n,localeOptions:r,separator:l,spacer:a,symbols:p,standard:u,output:c,fullform:f,fullforms:d,exponent:m,roundingMethod:y,precision:B})}export{g as filesize,y as partial};//# sourceMappingURL=filesize.min.js.map diff --git a/dist/filesize.umd.js b/dist/filesize.umd.js index 343ce4d..fa6522d 100644 --- a/dist/filesize.umd.js +++ b/dist/filesize.umd.js @@ -3,7 +3,7 @@ * * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 11.0.9 + * @version 11.0.10 */ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.filesize={}));})(this,(function(exports){'use strict';// Error Messages const INVALID_NUMBER = "Invalid number"; diff --git a/dist/filesize.umd.min.js b/dist/filesize.umd.min.js index bf53a7b..4edda17 100644 --- a/dist/filesize.umd.min.js +++ b/dist/filesize.umd.min.js @@ -1,5 +1,5 @@ /*! 2025 Jason Mulligan - @version 11.0.9 + @version 11.0.10 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).filesize={})}(this,function(t){"use strict";const e="iec",i="jedec",o="bits",n="byte",r="bytes",l="array",s="object",a="string",b="exponent",f="round",p="",u={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"]}},c=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,0x1000000000000000,11805916207174113e5,12089258196146292e8],d=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],m=Math.log(1024),g=Math.log(1e3);function y(t,{bits:y=!1,pad:h=!1,base:B=-1,round:M=2,locale:x="",localeOptions:T={},separator:j="",spacer:E=" ",symbols:P={},standard:w="",output:N=a,fullform:$=!1,fullforms:k=[],exponent:v=-1,roundingMethod:z=f,precision:G=0}={}){let K,S,Y,Z=v,O=Number(t),I=[],L=0,D=p;"si"===w?(K=!0,S=1e3,Y=i):w===e?(K=!1,S=1024,Y=e):w===i?(K=!1,S=1024,Y=i):2===B?(K=!1,S=1024,Y=e):(K=!0,S=1e3,Y=i);const q=!0===$,A=O<0,C=Math[z];if("bigint"!=typeof t&&isNaN(t))throw new TypeError("Invalid number");if("function"!=typeof C)throw new TypeError("Invalid rounding method");if(A&&(O=-O),0===O)return I[0]=G>0?(0).toPrecision(G):0,D=I[1]=u.symbol[Y][y?o:r][0],N===b?0:(P[I[1]]&&(I[1]=P[I[1]]),q&&(I[1]=k[0]||u.fullform[Y][0]+(y?"bit":n)),N===l?I:N===s?{value:I[0],symbol:I[1],exponent:0,unit:D}:I.join(E));if((-1===Z||isNaN(Z))&&(Z=K?Math.floor(Math.log(O)/g):Math.floor(Math.log(O)/m),Z<0&&(Z=0)),Z>8&&(G>0&&(G+=8-Z),Z=8),N===b)return Z;let F;F=K?d[Z]:c[Z],L=O/F,y&&(L*=8,L>=S&&Z<8&&(L/=S,Z++));const H=Z>0&&M>0?Math.pow(10,M):1;I[0]=1===H?C(L):C(L*H)/H,I[0]===S&&Z<8&&-1===v&&(I[0]=1,Z++),G>0&&(I[0]=I[0].toPrecision(G),I[0].includes("e")&&Z<8&&(Z++,F=K?d[Z]:c[Z],L=O/F,I[0]=(1===H?C(L):C(L*H)/H).toPrecision(G)));const J=u.symbol[Y][y?o:r];if(D=I[1]=K&&1===Z?y?"kbit":"kB":J[Z],A&&(I[0]=-I[0]),P[I[1]]&&(I[1]=P[I[1]]),!0===x?I[0]=I[0].toLocaleString():x.length>0?I[0]=I[0].toLocaleString(x,T):j.length>0&&(I[0]=I[0].toString().replace(".",j)),h&&M>0){const t=I[0].toString(),e=j||(t.match(/(\D)/g)||[]).pop()||".",i=t.split(e),o=i[1]||p,n=o.length,r=M-n;I[0]=`${i[0]}${e}${o.padEnd(n+r,"0")}`}return q&&(I[1]=k[Z]||u.fullform[Y][Z]+(y?"bit":n)+(1===I[0]?p:"s")),N===l?I:N===s?{value:I[0],symbol:I[1],exponent:Z,unit:D}:" "===E?`${I[0]} ${I[1]}`:I.join(E)}t.filesize=y,t.partial=function({bits:t=!1,pad:e=!1,base:i=-1,round:o=2,locale:n="",localeOptions:r={},separator:l="",spacer:s=" ",symbols:b={},standard:p="",output:u=a,fullform:c=!1,fullforms:d=[],exponent:m=-1,roundingMethod:g=f,precision:h=0}={}){return a=>y(a,{bits:t,pad:e,base:i,round:o,locale:n,localeOptions:r,separator:l,spacer:s,symbols:b,standard:p,output:u,fullform:c,fullforms:d,exponent:m,roundingMethod:g,precision:h})}});//# sourceMappingURL=filesize.umd.min.js.map diff --git a/package-lock.json b/package-lock.json index edde461..c88b901 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "filesize", - "version": "11.0.9", + "version": "11.0.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "filesize", - "version": "11.0.9", + "version": "11.0.10", "license": "BSD-3-Clause", "devDependencies": { "@rollup/plugin-terser": "^0.4.4", diff --git a/package.json b/package.json index cb1318c..101c116 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "filesize", "description": "JavaScript library to generate a human readable String describing the file size", - "version": "11.0.9", + "version": "11.0.10", "homepage": "https://filesizejs.com", "author": "Jason Mulligan ", "repository": {