Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created March 10, 2016 16:13
Show Gist options
  • Save ajcrites/f402829005e9db28804b to your computer and use it in GitHub Desktop.
Save ajcrites/f402829005e9db28804b to your computer and use it in GitHub Desktop.
const fs = require("fs");
const JSONStream = require("JSONStream");
const AWS = require("aws-sdk");
const csd = new AWS.CloudSearchDomain({endpoint: process.env.CSD_ENDPOINT, region: "us-east-1"});
const writeFile = fs.createWriteStream("big.json");
// const stringifier = JSONStream.stringify("[", ",", "]");
const stringifier = JSONStream.stringify();
stringifier.pipe(writeFile);
for (let i = 0; i < 10; i++) {
let fd = fs.openSync("/dev/urandom", "r");
let buffer = new Buffer(1000000);
fs.readSync(fd, buffer, 0, 1000000);
stringifier.write({content: buffer.toString("hex")});
}
stringifier.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment