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

fs-del

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-del - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

42

index.js

@@ -36,2 +36,24 @@ /**

del.count = function(files) {
var c = {
fileCount: 0,
dirCount: 0,
totalSize: 0
};
if (!files) {
return c;
}
if (!util.isArray(files)) {
files = [files];
}
files.forEach(function(f) {
_count(f, c);
});
return c;
};
module.exports = del;

@@ -58,1 +80,21 @@

}
function _count(f, c) {
if (!fs.existsSync(f)) {
return;
}
var stat = fs.statSync(f);
if (stat.isDirectory()) {
c.dirCount ++;
var subs = fs.readdirSync(f) || [];
subs.forEach(function(sub) {
_count(path.join(f, sub), c);
});
} else if (stat.isFile()) {
c.fileCount ++;
c.totalSize += stat.size;
}
}

2

package.json
{
"name": "fs-del",
"version": "1.0.1",
"version": "1.0.2",
"description": "delete files and folders",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,5 +17,10 @@ /**

it.only('empty', function() {
it('empty', function() {
del.empty('E:/test/s3')
})
});
it.only('count', function() {
var c = del.count('E:/test');
console.log(c);
});
});
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