0.1.0 • Published 8 years ago

find-in-csv v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

find-in-csv

Easy way finding a row in a CSV.

NPM

Install

$ npm install --save find-in-csv

Usage

var FindInCsv = require('find-in-csv');
var findInCsv = new FindInCsv( '/path/to/your.csv' );
/*
id,pw,name,prof
a,b,hoge,fuga
 */
findInCsv.get(
	{'id':'a', 'pw':'b'},
	function(result){
		console.log(result['id']); // a
		console.log(result['pw']); // b
		console.log(result['name']); // hoge
		console.log(result['prof']); // fuga
	}
);

Options

var FindInCsv = require('find-in-csv');
var findInCsv = new FindInCsv(
	'/path/to/your.csv',
	{
		"require": ['head1', 'head2'],
		"encrypted": {
			"pw": "sha1" // 'sha1' | 'md5'
		}
	}
);