Socket
Socket
Sign inDemoInstall

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

asynchronous file and directory operations for Node.js


Version published
Maintainers
1
Created

What is node-dir?

The node-dir package is a utility library for Node.js that provides methods to read directories recursively, read files within directories, and perform other directory and file system related operations. It is useful for applications that need to handle file system operations extensively.

What are node-dir's main functionalities?

Reading all files in a directory recursively

This feature allows you to list all files within a directory and its subdirectories. The function `dir.files` takes a directory path and a callback function that receives an array of file paths.

const dir = require('node-dir');
dir.files('/path/to/dir', function(err, files) {
  if (err) throw err;
  console.log(files);
});

Reading all subdirectories within a directory

This function lists all subdirectories within a specified directory. It is useful for applications that need to analyze or manipulate directory structures.

const dir = require('node-dir');
dir.subdirs('/path/to/dir', function(err, subDirs) {
  if (err) throw err;
  console.log(subDirs);
});

Reading content of files in a directory

This method reads the content of each file in a directory sequentially. It provides the file content to a callback function and proceeds to the next file when the `next` function is called.

const dir = require('node-dir');
dir.readFiles('/path/to/dir', function(err, content, next) {
  if (err) throw err;
  console.log(content);
  next();
});

Other packages similar to node-dir

Keywords

FAQs

Package last updated on 09 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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