function writeNDJson(path, collection) {
  const serialize = ndjson.serialize();
  fd = fs.openSync(path, 'w');
  serialize.on('data', line => {
    fs.appendFileSync(fd, line, 'utf8');
  });

  for (const item of collection) {
    serialize.write(item);
  }
}
Writes an array to an NDJSON file.

@param {string} path
@param {array} collection