Socket
Socket
Sign inDemoInstall

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 2.0.3 to 2.0.4

21

lib/filesize.js

@@ -9,3 +9,3 @@ /**

* @module filesize
* @version 2.0.3
* @version 2.0.4
*/

@@ -31,2 +31,3 @@ ( function ( global ) {

skip = false,
val = 0,
e, base, bits, ceil, neg, num, round, unix, spacer, suffix, z, suffixes;

@@ -69,18 +70,18 @@

if ( e > 8 ) {
result = result * ( 1000 * ( e - 8 ) );
e = 8;
val = val * ( 1000 * ( e - 8 ) );
e = 8;
}
if ( base === 2 ) {
result = num / Math.pow( 2, ( e * 10 ) );
val = num / Math.pow( 2, ( e * 10 ) );
}
else {
result = num / Math.pow( 1000, e );
val = num / Math.pow( 1000, e );
}
if ( bits ) {
result = ( result * 8 );
val = ( val * 8 );
if ( result > ceil ) {
result = result / ceil;
if ( val > ceil ) {
val = val / ceil;
e++;

@@ -90,3 +91,3 @@ }

result = result.toFixed( e > 0 ? round : 0 );
result = val.toFixed( e > 0 ? round : 0 );
suffix = si[bits ? "bits" : "bytes"][e];

@@ -110,3 +111,3 @@

if ( zero.test( z ) ) {
result = parseInt( result, radix );
result = parseInt( result, radix ).toString();
}

@@ -113,0 +114,0 @@

{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "2.0.3",
"version": "2.0.4",
"homepage": "http://filesizejs.com",

@@ -6,0 +6,0 @@ "author": {

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