Skip to content

Instantly share code, notes, and snippets.

View danherbert-epam's full-sized avatar

Dan Herbert danherbert-epam

  • EPAM Empathy Lab
View GitHub Profile
@danherbert-epam
danherbert-epam / directory.js
Last active October 8, 2016 19:17
Cross-Platflorm node.js directory node module, which includes mkdir and mkdirSync utilities which behave like the UNIX command "mkdir -p" which can be given a path with lots of non-existent nested directories and create any that are missing. One thing missing here that could be added in the future is the optional 'mode' argument, which exists in…
var fs = require('fs');
var pathSep = require('path').sep;
var directory = module.exports = {};
directory.mkdirSync = function __directory_mkdirSync__(path) {
var dirs = path.split(pathSep);
var root = "";