tree-json convert a directory tree to json Install $ npm install --save tree-json Usage var treejson = require('tree-json'); console.log(JSON.stringify( treejson("./pancake"), null, 2) );