Skip to content

Instantly share code, notes, and snippets.

@n-shinya
Created December 5, 2013 02:33
Show Gist options
  • Save n-shinya/7799274 to your computer and use it in GitHub Desktop.
Save n-shinya/7799274 to your computer and use it in GitHub Desktop.
'use strict';
var fs = require('fs');
var csv = 'Header\r\n';
for (var i = 1; i <= 1000000; i++) {
csv = csv + '"' + zeroPadding(i, 36) + '"';
if (i % 100 === 0) {
csv = csv + '\r\n';
} else {
csv = csv + ',';
}
}
fs.writeFile('xxx.csv', csv, function(err) {
if (err) {
console.log(err);
return;
}
console.log('complete');
})
function zeroPadding(number, length){
return (Array(length).join('0') + number).slice(-length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment