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

csv-string

Package Overview
Dependencies
Maintainers
3
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-string

PARSE and STRINGIFY for CSV strings. It's like JSON object but for CSV. It can also work row by row. And, if can parse strings, it can be use to parse files or streams too.

  • 4.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
145K
increased by14.42%
Maintainers
3
Weekly downloads
 
Created

What is csv-string?

The csv-string npm package provides simple utilities for parsing and stringifying CSV (Comma-Separated Values) data. It is lightweight and easy to use, making it suitable for basic CSV operations.

What are csv-string's main functionalities?

Stringify

This feature converts an array of arrays into a CSV string. The code sample demonstrates how to convert a 2D array into a CSV formatted string.

const CSVString = require('csv-string');
const data = [['name', 'age'], ['Alice', 30], ['Bob', 25]];
const csv = CSVString.stringify(data);
console.log(csv);

Parse

This feature parses a CSV string into an array of arrays. The code sample shows how to convert a CSV formatted string into a 2D array.

const CSVString = require('csv-string');
const csv = 'name,age\nAlice,30\nBob,25';
const data = CSVString.parse(csv);
console.log(data);

Detect

This feature detects the delimiter used in a CSV string. The code sample demonstrates how to detect the delimiter in a given CSV string.

const CSVString = require('csv-string');
const csv = 'name,age\nAlice,30\nBob,25';
const delimiter = CSVString.detect(csv);
console.log(delimiter);

Encode

This feature encodes an array into a CSV string. The code sample shows how to encode a single array into a CSV formatted string.

const CSVString = require('csv-string');
const data = ['Alice', '30'];
const encoded = CSVString.encode(data);
console.log(encoded);

Decode

This feature decodes a CSV string into an array. The code sample demonstrates how to decode a single CSV formatted string into an array.

const CSVString = require('csv-string');
const csv = 'Alice,30';
const decoded = CSVString.decode(csv);
console.log(decoded);

Other packages similar to csv-string

Keywords

FAQs

Package last updated on 03 Oct 2022

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