Skip to content

Instantly share code, notes, and snippets.

@gunar
gunar / recursiveDir.js
Last active March 6, 2016 00:21
Comparison of recursive directory listing methods in JavaScript
/*
* Comparison of methods to list all files in a directory
* and subdirectories ("recursive directory walk").
*
* gunargessner.com 2015-12-25
*
*/
var fs = require('fs');
var fsPath = require('path');
var _ = require('highland');
@dypsilon
dypsilon / highland_readdirp.js
Last active August 29, 2015 14:24
Recursive readdir using highland streams.
/**
* This function takes a directory path and returns a flat stream
* with stat objects + full file path in the .path property.
*/
var path = require('path');
var h = require('highland');
var readdir = h.wrapCallback(require('fs').readdir);
var stat = h.wrapCallback(require('fs').stat);