Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including readdirrsync with all npm packages installed. Try it out:

var readdirrsync = require("readdirrsync")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

readdirrsync v0.0.3

Synchronous, recursive readdir. Returns an array of (full) filepaths.


Synchronous, recursive readdir. Returns an array of (full) filepaths.

Example Usage

var readdirrsync = require('readdirrsync');

var dirStructure = readdirRSync(__dirname + '/testdir'); // return type: Array
/* dirStructure:
[ '/Users/jb/Developing/readdirRSync/test/testdir/file1.txt',
  '/Users/jb/Developing/readdirRSync/test/testdir/subdir/file4.txt' ]

Why Synchronous and Recursive

This module is handy, if you want to walk through the structure on a 'save' path. If it would be asynchronous the sorting of the structure could vary from time to time. Example use case: Generating hashes, there you will always want to put fileX before fileY because otherwise the hash would change!

var readdirrsync = require('readdirrsync');
var crypto       = require('crypto');
var hash         = crypto.createHash('md5');
var files        = readdirrsync(dirname);

for (var i in files) {





RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free