Node.js Directory to Json
Write a node.js program to get files or directories of a directory in JSON format.
Solution
Asynchronously convert directory tree structure into a javascript object.
Install with NPM
npm install dir-to-json --save
var dirToJson = require('dir-to-json');
dirToJson( "./album", function( err, dirTree ){
if( err ){
throw err;
}else{
console.log( dirTree );
}
});