# tsv

> Simple dependency-free TSV and CSV converter/parser

Latest version **0.2.0** (published 2013-03-13) · MIT (ricardo.mit-license.org) license · 0 weekly downloads

## Install

```sh
npm install tsv
pnpm add tsv
yarn add tsv
bun add tsv
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2013-03-13 |
| First published | 2013-01-18 |
| Weekly downloads | 0 |
| License | MIT (ricardo.mit-license.org) |
| TypeScript types | separate (@types/tsv) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Ricardo Tomasi |
| Maintainers | ricardobeat |
| Keywords | tsv, csv, converter, parser, json, separated, delimited, d3 |

## Links

- npm: https://www.npmjs.com/package/tsv
- Repository: https://github.com/ricardobeat/TSV
- npm.io page: https://npm.io/package/tsv

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.0 (latest) — 2013-03-13
- 0.1.1 — 2013-01-19
- 0.1.0 — 2013-01-18

## README

TSV
===

Simple TSV/CSV converter and parser. Good for serving time-series (or any series) data to use in D3.js or other client-side graph libraries.

Processing is *synchronous*. **Do not use** for large datasets - use something that supports streams instead, like [node-csv-parser](http://npmjs.org/node-csv-parser).

### Install

    npm install tsv

### Usage

    var csv = require('csv')
    var tsv = require('xsv').tsv
    { tsv, csv } = require 'xsv' // coffeescript

The `data` argument for stringify must be a flat array of objects. Keys will be derived from the first item.

    TSV.stringify([
        { id: 1, name: 'xx' },
        { id: 2, name: 'yy' }
        ...
    ])

Outputs

    id  name
    1   xx
    2   yy

### API

- `TSV.stringify(object)`
- `TSV.parse(tsv_string)`
- `CSV.stringify(object)`
- `CSV.parse(csv_string)`

#### Options and custom separators

No headers:

    // Creating a new parser
    var Parser = require('tsv').Parser
    var CSV = new Parser(",", { header: false })

    // Using the default parser
    var CSV = require('tsv').CSV
    CSV.header = false

Custom "pipe-separated values":

    var TSV = require('tsv')
    PSV = new TSV.Parser("|")

    var res = PSV.parse(...)

---
_Source: https://npm.io/package/tsv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
