decode kv config files as used by subversion
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
Transforms a input stream of kv data into a object with key value pairs assigned
stream
StreamgotValue
ValueProvider
Returns Promise resolving to object
call back function to provide key and value
Type: Function
With npm do:
npm install kv-reader