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 1.9.1 to 1.9.2

18

lib/filesize.js

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

* @module filesize
* @version 1.9.1
* @version 1.9.2
*/

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

bit = /b$/,
byte = /^B$/,
zero = /^0$/,

@@ -43,2 +44,3 @@ options = {

bits = true,
skip = false,
i, neg, num, pos, short, size, sizes, suffix, z;

@@ -77,7 +79,3 @@

if ( num === 0 ) {
if ( short ) {
pos = 0;
}
result = Number( 0 ).toFixed( pos ) + "B";
result = Number( 0 ).toFixed( 0 ) + "B";
}

@@ -99,5 +97,11 @@ else {

if ( num >= size ) {
// Treating bytes as cardinal
if ( byte.test( suffix ) ) {
skip = true;
pos = 0;
}
result = ( num / size ).toFixed( pos );
if ( short ) {
if ( !skip && short ) {
if ( bits && bit.test( suffix ) ) {

@@ -104,0 +108,0 @@ suffix = suffix.toLowerCase();

{
"name": "filesize",
"description": "JavaScript library to generate a human readable String describing the file size",
"version": "1.9.1",
"version": "1.9.2",
"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