Registry / devops / ltsv
library4.0.1jsnpmunverified

LTSV (Labeled Tab Separated Values) parser, formatter, validator, and TransformStream for Node.js. Version 4.0.1 requires Node >=20 and is ESM-only with full TypeScript type definitions. Provides parse, parseLine, format, validate, and a Node.js stream interface. Designed for efficient LTSV log processing. Releases are infrequent but stable. Differentiates with stream support and strict mode validation.

npm install ltsv
INSTALL
IMPORT
SIG · LTSV
L
ltsv
devopsjavascriptv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ltsv
import * as ltsv from 'ltsv'
const ltsv = require('ltsv')
ESM-only since v4. CommonJS require will not work.
parseLine
import { parseLine } from 'ltsv'
import parseLine from 'ltsv'
Named export, not default. Use destructuring.
createLtsvToJsonStream
import { createLtsvToJsonStream } from 'ltsv/nodejs_stream'
import { createLtsvToJsonStream } from 'ltsv'
Stream functions are in a separate subpath export. Importing from 'ltsv' will not include them.

Parse and format LTSV data using the main module. Shows basic usage of parse and format functions.

import * as ltsv from 'ltsv'; // Parse LTSV string to array of objects const parsed = ltsv.parse( 'label1:value1\tlabel2:value2\n' + 'label1:value3\tlabel2:value4' ); console.log(parsed); // [ { label1: 'value1', label2: 'value2' }, // { label1: 'value3', label2: 'value4' } ] // Format array of objects to LTSV string const formatted = ltsv.format([ { label1: 'value1', label2: 'value2' }, { label1: 'value3', label2: 'value4' } ]); console.log(formatted); // 'label1:value1\tlabel2:value2\nlabel1:value3\tlabel2:value4'
Debug
Known issues
breakingPackage is ESM-only since v4. Node.js >=20 required. CommonJS require() will throw.
fix
Use import syntax or upgrade to Node >=20. If CommonJS needed, use v3.x (last CJS version).
affects: >=4.0.0
gotchaStream functions are only available via 'ltsv/nodejs_stream' subpath import, not from main 'ltsv'
fix
Import from 'ltsv/nodejs_stream' for createLtsvToJsonStream, createLtsvToObjectStream, etc.
affects: *
gotchaThe parse() function expects a string. Passing a Buffer will cause type errors in TypeScript.
fix
Convert Buffer to string using .toString() or use stream for binary input.
affects: *
deprecatedThe old CommonJS API (require('ltsv')) is removed in v4. Default export no longer exists.
fix
Use named imports: import * as ltsv from 'ltsv' or import { parse } from 'ltsv'.
affects: >=4.0.0
gotchaValues containing newline characters are not escaped in format(). Output may be invalid LTSV.
fix
Manually sanitize values or use strict mode validation before formatting.
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/ltsv/dist/index.js from /path/to/app.js not supported.
Using require() on ESM-only package v4.
fix
Switch to import syntax or downgrade to ltsv@3 that supports CommonJS.
SyntaxError: Named export 'createLtsvToJsonStream' not found. The requested module 'ltsv' is a commonjs module which may not support all module.exports as named exports.
Importing createLtsvToJsonStream from main 'ltsv' instead of 'ltsv/nodejs_stream'.
fix
Change import to: import { createLtsvToJsonStream } from 'ltsv/nodejs_stream';
TypeError: ltsv.parse is not a function
Using default import instead of namespace or named import.
fix
Use import * as ltsv from 'ltsv' or import { parse } from 'ltsv'.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
packageltsv
ltsv — npm install ltsv · libregistry