Socket
Socket
Sign inDemoInstall

fs-recurse

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fs-recurse

Walk through directories asynchronously with callback on each file/folder


Version published
Maintainers
1
Install size
898 kB
Created

Readme

Source

fs-recurse

Walk through directories asynchronously, with callback on each file/folder and ignore option

Usage

npm install fs-recurse

Signature

recurse(String path, Function callback, Function done, Array ignore);
Arguments
  1. path String

    Path in which you want to recurse

  2. callback Function

    Receives four arguments :

    • path String current path
    • filename String current file name
    • type String file extension or 'folder'
    • cursor Function call this function after executing any async operation on current file
  3. done Function

    Invoked when recursion is done

  4. ignore Array

    Anymatch compatible filters...

Example

var recurse = require('./fs-recurse');

recurse('test', function(path, filename, type, cursor){
	fs.stat(path + '/' + file, function(err, stats){
		cursor();
		// Do async operation on files ...
	});
}, function(){
	console.log('Done!');
}, [/\.txt$/, 'index.html']);
// *.txt and index.html will be ignored

Keywords

FAQs

Last updated on 23 Mar 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