Skip to content

arlac77/kv-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm License bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

kv-reader

decode kv config files as used by subversion

example

K 8
passtype
V 8
keychain
K 15
svn:realmstring
V 62
<https://subversion.assembla.com:443> Assembla Restricted Area
K 8
username
V 7
abcdefg
END
import { createReadStream } from "fs";
import { reader } from "kv-reader";

async function sample() {
  const kv = {};
  await reader(
    createReadStream("tests/fixtures/s1"),
    (key, value) => (kv[key] = value)
  );
  console.log(`passtype = ${kv.passtype}`);
}

sample();
passtype = keychain
svn:realmstring = <https://subversion.assembla.com:443> Assembla Restricted Area
username = abcdefg

API

Table of Contents

reader

Transforms a input stream of kv data into a object with key value pairs assigned

Parameters

Returns Promise resolving to object

ValueProvider

call back function to provide key and value

Type: Function

Parameters

install

With npm do:

npm install kv-reader

license

BSD-2-Clause