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

node-dir

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-dir - npm Package Compare versions

Comparing version 0.1.6 to 0.1.8

2

package.json
{
"name": "node-dir",
"version": "0.1.6",
"version": "0.1.8",
"description": "asynchronous file and directory operations for Node.js",

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

@@ -95,2 +95,23 @@ [![Build Status](https://secure.travis-ci.org/fshost/node-dir.png)](http://travis-ci.org/fshost/node-dir)

Note that for the files and subdirs the object returned is an array, and thus all of the standard array methods are available for use in your callback for operations like filters or sorting. Some quick examples:
```javascript
dir.files(__dirname, function(err, files) {
if (err) throw err;
// sort ascending
files.sort();
// sort descending
files.reverse();
// include only certain filenames
files = files.filter(function (file) {
return ['allowed', 'file', 'names'].indexOf(file) > -1;
});
// exclude some filenames
files = files.filter(function (file) {
return ['exclude', 'these', 'files'].indexOf(file) === -1;
});
});
```
Also note that if you need to work with the contents of the files asynchronously, please use the readFiles method. The files and subdirs methods are for getting a list of the files or subdirs in a directory as an array.

@@ -107,3 +128,2 @@ #### subdirs( dir, callback )

#### paths(dir, [combine], callback )

@@ -110,0 +130,0 @@ Asynchronously iterate the subdirectories of a directory and its subdirectories and pass an array of both file and directory paths to a callback.

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