Node error: stdout is not a tty [Fixed]

When you try to pipe output to a file in Windows / msysgit or git bash, you may get this error:

$ node cmd.js > retrieve.sh
stdout is not a tty

Rather than writing to the file via shell, do this:

var writable = fs.createWriteStream('retrieve.sh', {flags:'w'});
writable.write('mkdir -p ' + path + '\n');
writable.write(
  'curl -o ' + path + entry.id + '.txt "' + entry.url + '"\n'
);