Skip to main content
Module

x/csv/mod.ts>writeCSVObjects

Streaming API for reading and writing CSV for https://deno.land/
Latest
function writeCSVObjects
import { writeCSVObjects } from "https://deno.land/x/csv@v0.9.2/mod.ts";

Write CSV with sync or async object iterators:

  await writeCSVObjects(f, [{a: "1"}, {a: "2"}], { header: ["a"] });

  const asyncObjectsGenerator = async function*() {
    yield { a: "1", b: "2", c: "3" };
    yield { a: "4", b: "5", c: "6" };
  }
  await writeCSVObjects(f, asyncObjectsGenerator(), { header: ["a", "b", "c"] });

Parameters

writer: Deno.Writer
iter: SyncAsyncIterable<{ [key: string]: string; }>
options: Partial<CSVWriterOptions & CSVWriteCellOptions> & { header: string[]; }