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

node-readfiles

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-readfiles - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

2

package.json
{
"name": "node-readfiles",
"version": "0.0.5",
"version": "0.0.6",
"description": "A lightweight Node.js module to recursively read files in a directory",

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

@@ -149,3 +149,35 @@ # node-readfiles

A simple example that works like `find`
```javascript
var readfiles = require('node-readfiles');
var path = require('path');
function fileSize(size) {
var unit = 'B';
if (size > 1000000000) {
unit = 'T';
size /= 1000000000;
}else if (size > 1000000) {
unit = 'M';
size /= 1000000;
}else if (size > 1000) {
unit = 'K';
size /= 1000;
}
return (Math.round(size * 10) / 10) + unit;
}
var basepath = path.resolve(process.cwd(), process.argv.pop());
readfiles(basepath, {
readContents: false
}, function (err, filename, content, stat) {
console.log(filename, fileSize(stat.size), (stat.mode & 0777).toString(8));
}, function (err, files, count) {
console.log('\nTotal of', count, 'file(s) found\n');
});
```
## License
MIT licensed (See LICENSE.txt)
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