Socket
Socket
Sign inDemoInstall

csv-wp

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    csv-wp

A CSV writer and parser


Version published
Weekly downloads
12
increased by71.43%
Maintainers
1
Install size
8.70 kB
Created
Weekly downloads
 

Readme

Source

csv-wp

A simple CSV writer and parser

Installation
$ npm install csv-wp
Usage:
const csvwp = require('csv-wp')

 //Optional. These are default values
const options = {
    encoding: 'UTF-8',
    delimiter: ',' //',' or ';'
}

//Print entire .csv file
csvwp.printLines('example.csv', options)

//Returns an Array with all lines
let lines = csvwp.getLines('example.csv', options);

//Returns an Array with the 5th line
let line = csvwp.getSingleLine('example.csv', 5, options);

//Returns .csv header (line 0)
let header = csvwp.getHeader('example.csv', options);

//Returns an Array with a given collumn
let atr = csvwp.getAttribute('example.csv', 'CONTACT', options);

//Find rows by searching a (key,value) pair
let found = csvwp.find('example.csv', 'CONTACT', 'example@example.com', options);

//Append a row to a .csv file
const data = ['03/24/2020 08:26','Testing','example@example.com','+553298','Verified'];
csvwp.appendRow('example.csv', data, options);

//Write a row to a .csv file (Current data will be overwritten)
const data = ['03/24/2020 08:26','Testing','example@example.com','+553298','Verified'];
csvwp.writeRow('example.csv', data, options);

//Write an entire .csv file with header and body
const header = ['Date','Name','Email','Contact','Status'];
let data = [['24/03/2020 08:26','Name 1','test@test.com','+553298','Verified'],
            ['18/10/2019 11:43','Name 2','mail@mail.com','+553298','Pending']];
csvwp.writeCSV('example.csv', header, data, options);

Keywords

FAQs

Last updated on 12 May 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc