8000 GitHub - tjosepo/deno_csv: Simple utility functions for reading CSV files
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tjosepo/deno_csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deno_csv

Simple utility functions for reading CSV files.

CSV.parse

Parses a CSV string. Returns an array of lines, which contain an array of fields.

import * as CSV from './deps.ts';

const text = await Deno.readTextFile("./addresses.csv");
const lines = CSV.parse(text);

console.log(lines[0][0]);

You can optionally set the header option to true to obtain each lines as an objects, using the first line as the keys.

import * as CSV from './deps.ts';

const text = await Deno.readTextFile("./people.csv", { header: true });
const people = CSV.parse(text);

console.log(people[0].name);

CSV.read

Reads a CSV string asynchronously. Useful when working on very large files or dealing with real-time data from a readable stream.

import * as CSV from './deps.ts';

const file = await Deno.open("./very_large_file.csv");

for await (const line of CSV.read(file.readable)) {
  for (const field of line) {
    console.log(field);
  }
}

About

Simple utility functions for reading CSV files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0