Socket
Socket
Sign inDemoInstall

recursive-readdir-sync

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    recursive-readdir-sync

NodeJS library to recursively read a directory path's contents synchronously


Version published
Weekly downloads
26K
increased by1.22%
Maintainers
1
Install size
5.76 kB
Created
Weekly downloads
 

Readme

Source

recursive-readdir-sync

NodeJS library to recursively read a directory path's contents synchronously

A simple Node module for synchronously listing all files in a directory, or in any subdirectories.

It does not list directories themselves.

This library uses synchronous filesystem calls. That means this library uses BLOCKING calls. Keep that in mind when using it.

Install

npm install recursive-readdir-sync

Example

var recursiveReadSync = require('recursive-readdir-sync')
  , files
  ;

try {
  files = recursiveReadSync('/your/path/here');
} catch(err){
  if(err.errno === 34){
    console.log('Path does not exist');
  } else {
    //something unrelated went wrong, rethrow
    throw err;
  }
}

console.log('Files array:', files);

//loop over resulting files
for(var i = 0, len = files.length; i < len; i++){
  console.log('Found: %s', files[i]);
}

Keywords

FAQs

Last updated on 27 Feb 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc