diff --git a/CHANGELOG.md b/CHANGELOG.md index acdfe75..2204507 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.12](https://github.com/avoidwork/filesize.js/compare/11.0.11...11.0.12) + +- Fixing README.md [`096b755`](https://github.com/avoidwork/filesize.js/commit/096b7556a69534b5b72a0fbe0f11255a5a274a85) + #### [11.0.11](https://github.com/avoidwork/filesize.js/compare/11.0.10...11.0.11) +> 21 September 2025 + - Updates [`#207`](https://github.com/avoidwork/filesize.js/pull/207) +- Updating CHANGELOG.md [`df0978a`](https://github.com/avoidwork/filesize.js/commit/df0978af725626117c6f7bd86c53daec17a99540) #### [11.0.10](https://github.com/avoidwork/filesize.js/compare/11.0.9...11.0.10) diff --git a/README.md b/README.md index 8006fe5..c6b54ce 100644 --- a/README.md +++ b/README.md @@ -137,9 +137,9 @@ filesize.js is optimized for high performance with comprehensive benchmarks cove - **filesize(0)**: 18.6M ops/sec - **filesize(512)**: 20.3M ops/sec - **filesize(1024)**: 18.7M ops/sec -- **filesize(1MB)**: 23.5M ops/sec -- **filesize(1GB)**: 23.6M ops/sec -- **filesize(1TB)**: 26.9M ops/sec +- **filesize(1048576)**: 23.5M ops/sec +- **filesize(1073741824)**: 23.6M ops/sec +- **filesize(1099511627776)**: 26.9M ops/sec - **With bits=true**: 16.8M ops/sec - **With standard="iec"**: 16.6M ops/sec - **With round=4**: 13.4M ops/sec diff --git a/dist/filesize.cjs b/dist/filesize.cjs index baafdf4..3a42205 100644 --- a/dist/filesize.cjs +++ b/dist/filesize.cjs @@ -3,7 +3,7 @@ * * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 11.0.11 + * @version 11.0.12 */ 'use strict'; diff --git a/dist/filesize.js b/dist/filesize.js index 0f06e20..8e3564d 100644 --- a/dist/filesize.js +++ b/dist/filesize.js @@ -3,7 +3,7 @@ * * @copyright 2025 Jason Mulligan * @license BSD-3-Clause - * @version 11.0.11 + * @version 11.0.12 */ // Error Messages const INVALID_NUMBER = "Invalid number"; diff --git a/dist/filesize.min.js b/dist/filesize.min.js index f091779..f552c9e 100644 --- a/dist/filesize.min.js +++ b/dist/filesize.min.js @@ -1,5 +1,5 @@ /*! 2025 Jason Mulligan - @version 11.0.11 + @version 11.0.12 */ const t="iec",e="jedec",i="si",n="bits",a="byte",o="bytes",r="array",l="object",s="string",c="exponent",u="round",b={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"]}},d=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,0x1000000000000000,11805916207174113e5,12089258196146292e8],f=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],p=Math.log(1024),m=Math.log(1e3),B={[i]:{isDecimal:!0,ceil:1e3,actualStandard:e},[t]:{isDecimal:!1,ceil:1024,actualStandard:t},[e]:{isDecimal:!1,ceil:1024,actualStandard:e}};function y(t,e,i,n,a){let o=t/(i?f[e]:d[e]);return n&&(o*=8,o>=a&&e<8&&(o/=a,e++)),{result:o,e:e}}function M(i,{bits:d=!1,pad:f=!1,base:M=-1,round:h=2,locale:g="",localeOptions:x={},separator:D="",spacer:E=" ",symbols:S={},standard:T="",output:v=s,fullform:N=!1,fullforms:$=[],exponent:j=-1,roundingMethod:k=u,precision:w=0}={}){let G=j,K=Number(i),P=[],Y=0,Z="";const{isDecimal:O,ceil:z,actualStandard:I}=function(i,n){return B[i]?B[i]:2===n?{isDecimal:!1,ceil:1024,actualStandard:t}:{isDecimal:!0,ceil:1e3,actualStandard:e}}(T,M),q=!0===N,A=K<0,C=Math[k];if("bigint"!=typeof i&&isNaN(i))throw new TypeError("Invalid number");if("function"!=typeof C)throw new TypeError("Invalid rounding method");if(A&&(K=-K),0===K)return function(t,e,i,s,u,d,f,p){const m=[];m[0]=t>0?(0).toPrecision(t):0;const B=m[1]=b.symbol[e][i?n:o][0];return f===c?0:(s[m[1]]&&(m[1]=s[m[1]]),u&&(m[1]=d[0]||b.fullform[e][0]+(i?"bit":a)),f===r?m:f===l?{value:m[0],symbol:m[1],exponent:0,unit:B}:m.join(p))}(w,I,d,S,q,$,v,E);if((-1===G||isNaN(G))&&(G=O?Math.floor(Math.log(K)/m):Math.floor(Math.log(K)/p),G<0&&(G=0)),G>8&&(w>0&&(w+=8-G),G=8),v===c)return G;const{result:F,e:H}=y(K,G,O,d,z);Y=F,G=H;const J=G>0&&h>0?Math.pow(10,h):1;if(P[0]=1===J?C(Y):C(Y*J)/J,P[0]===z&&G<8&&-1===j&&(P[0]=1,G++),w>0){const t=function(t,e,i,n,a,o,r,l,s){let c=t.toPrecision(e);if(c.includes("e")&&i<8){i++;const{result:t}=y(n,i,a,o,r),u=s>0?Math.pow(10,s):1;c=(1===u?l(t):l(t*u)/u).toPrecision(e)}return{value:c,e:i}}(P[0],w,G,K,O,d,z,C,h);P[0]=t.value,G=t.e}const L=b.symbol[I][d?n:o];return Z=P[1]=O&&1===G?d?"kbit":"kB":L[G],A&&(P[0]=-P[0]),S[P[1]]&&(P[1]=S[P[1]]),P[0]=function(t,e,i,n,a,o){let r=t;if(!0===e?r=r.toLocaleString():e.length>0?r=r.toLocaleString(e,i):n.length>0&&(r=r.toString().replace(".",n)),a&&o>0){const t=r.toString(),e=n||(t.match(/(\D)/g)||[]).pop()||".",i=t.split(e),a=i[1]||"",l=a.length,s=o-l;r=`${i[0]}${e}${a.padEnd(l+s,"0")}`}return r}(P[0],g,x,D,f,h),q&&(P[1]=$[G]||b.fullform[I][G]+(d?"bit":a)+(1===P[0]?"":"s")),v===r?P:v===l?{value:P[0],symbol:P[1],exponent:G,unit:Z}:" "===E?`${P[0]} ${P[1]}`:P.join(E)}function h({bits:t=!1,pad:e=!1,base:i=-1,round:n=2,locale:a="",localeOptions:o={},separator:r="",spacer:l=" ",symbols:c={},standard:b="",output:d=s,fullform:f=!1,fullforms:p=[],exponent:m=-1,roundingMethod:B=u,precision:y=0}={}){return s=>M(s,{bits:t,pad:e,base:i,round:n,locale:a,localeOptions:o,separator:r,spacer:l,symbols:c,standard:b,output:d,fullform:f,fullforms:p,exponent:m,roundingMethod:B,precision:y})}export{M as filesize,h as partial};//# sourceMappingURL=filesize.min.js.map diff --git a/dist/filesize.umd.js b/dist/filesize.umd.js index 87417aa..1dd755c 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.11 + * @version 11.0.12 */ (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 914f6cf..4c7f5ce 100644 --- a/dist/filesize.umd.min.js +++ b/dist/filesize.umd.min.js @@ -1,5 +1,5 @@ /*! 2025 Jason Mulligan - @version 11.0.11 + @version 11.0.12 */ !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",n="si",o="bits",a="byte",r="bytes",s="array",l="object",u="string",c="exponent",b="round",d={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"]}},f=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,0x1000000000000000,11805916207174113e5,12089258196146292e8],p=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],m=Math.log(1024),y=Math.log(1e3),B={[n]:{isDecimal:!0,ceil:1e3,actualStandard:i},[e]:{isDecimal:!1,ceil:1024,actualStandard:e},[i]:{isDecimal:!1,ceil:1024,actualStandard:i}};function h(t,e,i,n,o){let a=t/(i?p[e]:f[e]);return n&&(a*=8,a>=o&&e<8&&(a/=o,e++)),{result:a,e:e}}function M(t,{bits:n=!1,pad:f=!1,base:p=-1,round:M=2,locale:g="",localeOptions:x={},separator:T="",spacer:D=" ",symbols:E={},standard:S="",output:j=u,fullform:v=!1,fullforms:N=[],exponent:$=-1,roundingMethod:k=b,precision:w=0}={}){let G=$,K=Number(t),P=[],Y=0,Z="";const{isDecimal:O,ceil:z,actualStandard:I}=function(t,n){return B[t]?B[t]:2===n?{isDecimal:!1,ceil:1024,actualStandard:e}:{isDecimal:!0,ceil:1e3,actualStandard:i}}(S,p),q=!0===v,A=K<0,C=Math[k];if("bigint"!=typeof t&&isNaN(t))throw new TypeError("Invalid number");if("function"!=typeof C)throw new TypeError("Invalid rounding method");if(A&&(K=-K),0===K)return function(t,e,i,n,u,b,f,p){const m=[];m[0]=t>0?(0).toPrecision(t):0;const y=m[1]=d.symbol[e][i?o:r][0];return f===c?0:(n[m[1]]&&(m[1]=n[m[1]]),u&&(m[1]=b[0]||d.fullform[e][0]+(i?"bit":a)),f===s?m:f===l?{value:m[0],symbol:m[1],exponent:0,unit:y}:m.join(p))}(w,I,n,E,q,N,j,D);if((-1===G||isNaN(G))&&(G=O?Math.floor(Math.log(K)/y):Math.floor(Math.log(K)/m),G<0&&(G=0)),G>8&&(w>0&&(w+=8-G),G=8),j===c)return G;const{result:F,e:H}=h(K,G,O,n,z);Y=F,G=H;const J=G>0&&M>0?Math.pow(10,M):1;if(P[0]=1===J?C(Y):C(Y*J)/J,P[0]===z&&G<8&&-1===$&&(P[0]=1,G++),w>0){const t=function(t,e,i,n,o,a,r,s,l){let u=t.toPrecision(e);if(u.includes("e")&&i<8){i++;const{result:t}=h(n,i,o,a,r),c=l>0?Math.pow(10,l):1;u=(1===c?s(t):s(t*c)/c).toPrecision(e)}return{value:u,e:i}}(P[0],w,G,K,O,n,z,C,M);P[0]=t.value,G=t.e}const L=d.symbol[I][n?o:r];return Z=P[1]=O&&1===G?n?"kbit":"kB":L[G],A&&(P[0]=-P[0]),E[P[1]]&&(P[1]=E[P[1]]),P[0]=function(t,e,i,n,o,a){let r=t;if(!0===e?r=r.toLocaleString():e.length>0?r=r.toLocaleString(e,i):n.length>0&&(r=r.toString().replace(".",n)),o&&a>0){const t=r.toString(),e=n||(t.match(/(\D)/g)||[]).pop()||".",i=t.split(e),o=i[1]||"",s=o.length,l=a-s;r=`${i[0]}${e}${o.padEnd(s+l,"0")}`}return r}(P[0],g,x,T,f,M),q&&(P[1]=N[G]||d.fullform[I][G]+(n?"bit":a)+(1===P[0]?"":"s")),j===s?P:j===l?{value:P[0],symbol:P[1],exponent:G,unit:Z}:" "===D?`${P[0]} ${P[1]}`:P.join(D)}t.filesize=M,t.partial=function({bits:t=!1,pad:e=!1,base:i=-1,round:n=2,locale:o="",localeOptions:a={},separator:r="",spacer:s=" ",symbols:l={},standard:c="",output:d=u,fullform:f=!1,fullforms:p=[],exponent:m=-1,roundingMethod:y=b,precision:B=0}={}){return u=>M(u,{bits:t,pad:e,base:i,round:n,locale:o,localeOptions:a,separator:r,spacer:s,symbols:l,standard:c,output:d,fullform:f,fullforms:p,exponent:m,roundingMethod:y,precision:B})}});//# sourceMappingURL=filesize.umd.min.js.map diff --git a/package-lock.json b/package-lock.json index 970618c..69e6cca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "filesize", - "version": "11.0.11", + "version": "11.0.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "filesize", - "version": "11.0.11", + "version": "11.0.12", "license": "BSD-3-Clause", "devDependencies": { "@rollup/plugin-terser": "^0.4.4", diff --git a/package.json b/package.json index 88f42f1..3e2ff6e 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.11", + "version": "11.0.12", "homepage": "https://filesizejs.com", "author": "Jason Mulligan ", "repository": {