NodeJS Module to help generate files

I'm looking for a nodejs module to use in my project that will generate files and directories.

To give some background, my node project makes use of certain user made widgets, each of which has a very specific configuration and file layout. I want a simple way of generating these skeleton files for the user, using some of the info they input as parameters

Desired Workflow

$ mymodule make new widget
What kind of widget do you want? (dbquery, htmlquery)
> dbquery
What name do you want to give to your widget?
> samplename
In which directory are your widgets located?
>  /home/name/Code/dashboard/widgets
...generating samplename dbquery widget *(creates a couple of folders and files with some basic content)*
DONE!

$

The core fs module can create files and directories.

Use the module

var fs = require('fs');

Create a file:

fs.writeFile('message.txt', 'Hello Node', function (err) {
  if (err) throw err;
  console.log('It\'s saved!');
});

Create a directory:

fs.mkdir('test', function(err) {
  console.log('done');
});

Another cool module is mkdirp. Works like mkdir -p. The content of your skeleton files can either be stored in a js variable/string and then be written to the users' files or you could use some dummy files and read the content from there:

fs.readFile('/widget/layout.conf', function (err, data) {
  if (err) throw err;
  console.log(data);
});

I started a project similar to what you have been asking for. It's a Node.js module that can be installed globally that scaffolds modules and / or applications based on a GitHub repositories.

See nudo for details.