Skip to content

Instantly share code, notes, and snippets.

@n-shinya
Created December 5, 2013 02:35
Show Gist options
  • Save n-shinya/7799290 to your computer and use it in GitHub Desktop.
Save n-shinya/7799290 to your computer and use it in GitHub Desktop.
'use strict';
var fs = require('fs');
var body = '';
var line = {ids:[]};
for (var i = 1; i <= 1000000; i++) {
line.ids.push(''+zeroPadding(i, 36))
if (i % 100 === 0) {
body = body + JSON.stringify(line) + '\n';
line.ids = [];
}
}
fs.writeFile('xxx.json', body, 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