
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
LTSV parser and formatter
http://sasaplus1.github.io/ltsv.js/
$ npm install ltsv
$ bower install ltsv
var ltsv = require('ltsv');
<script src="ltsv.min.js"></script>
ltsv.parse(
'label1:value1\tlabel2:value2\n' +
'label1:value1\tlabel2:value2\n' +
'label1:value1\tlabel2:value2'
);
// [ { label1: 'value1', label2: 'value2' },
// { label1: 'value1', label2: 'value2' },
// { label1: 'value1', label2: 'value2' } ]
ltsv.parseLine('label1:value1\tlabel2:value2');
// { label1: 'value1', label2: 'value2' }
ltsv.parseLine('label1:value1\tlabel2:value2\n');
// { label1: 'value1', label2: 'value2' }
ltsv.parseLine('label1:value1\tlabel2:value2\r\n');
// { label1: 'value1', label2: 'value2' }
ltsv.format([
{ label1: 'value1', label2: 'value2' },
{ label1: 'value1', label2: 'value2' },
{ label1: 'value1', label2: 'value2' }
]);
// 'label1:value1\tlabel2:value2\nlabel1:value1\tlabel2:value2\nlabel1:value1\tlabel2:value2'
ltsv.format({ label1: 'value1', label2: 'value2' });
// 'label1:value1\tlabel2:value2'
var fs = require('fs'),
ltsv = require('ltsv'),
ltjs = ltsv.createLtsvToJsonStream({
toObject: false,
strict: false
});
// access.log:
// l1:v1\tl2:v2\n
// l1:v1\tl2:v2\n
// l1:v1\tl2:v2\n
fs.createReadStream('./access.log').pipe(ltjs).pipe(process.stdout);
// {"l1":"v1","l2":"v2"}{"l1":"v1","l2":"v2"}{"l1":"v1","l2":"v2"}
text
String - LTSV textreturn
Object[] - parsed objectssplit to LTSV records.
throw SyntaxError if text has no separator.
line
String - LTSV linereturn
Object - parsed objectsplit to LTSV record.
throw SyntaxError if line has no separator.
text
String - LTSV textreturn
Object[] - parsed objectssplit to LTSV records and validate label and value of fields.
throw SyntaxError if text has no separator.
also throw SyntaxError if text has unexpected character.
line
String - LTSV linereturn
Object - parsed objectsplit to LTSV record.
throw SyntaxError if line has no separator.
also throw SyntaxError if line has unexpected character.
data
Object|Object[] - object or object arrayreturn
String - LTSV textconvert to LTSV text.
throw TypeError if data is not an object or array.
data
Object|Object[] - object or object arrayreturn
String - LTSV textconvert to LTSV text.
throw TypeError if data is not an object or array.
also throw SyntaxError if data has unexpected character.
options
Object - option objectreturn
LtsvToJsonStream - LTSV to JSON streamreturn LtsvToJsonStream instance. this function cannot use by browser.
encoding
String - StringDecoder's encoding, default is utf8toObject
Boolean - convert to Object if true, default is falsestrict
Boolean - strict parse if true, default is false$ npm install
$ npm test
$ npm install
$ npm run testem
The MIT license. Please see LICENSE file.
FAQs
LTSV parser, formatter, validator and TransformStream
The npm package ltsv receives a total of 514 weekly downloads. As such, ltsv popularity was classified as not popular.
We found that ltsv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.