Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsv

Simple dependency-free TSV and CSV converter/parser

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35K
increased by1.42%
Maintainers
1
Weekly downloads
 
Created
Source

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.

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(...)

Keywords

FAQs

Package last updated on 13 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc