{"id":41435,"library":"ltsv","title":"ltsv","description":"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.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/sasaplus1/ltsv.js","tags":["javascript","formatter","ltsv","parser","stream","validator","typescript"],"install":[{"cmd":"npm install ltsv","lang":"bash","label":"npm"},{"cmd":"yarn add ltsv","lang":"bash","label":"yarn"},{"cmd":"pnpm add ltsv","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v4. CommonJS require will not work.","wrong":"const ltsv = require('ltsv')","symbol":"ltsv","correct":"import * as ltsv from 'ltsv'"},{"note":"Named export, not default. Use destructuring.","wrong":"import parseLine from 'ltsv'","symbol":"parseLine","correct":"import { parseLine } from 'ltsv'"},{"note":"Stream functions are in a separate subpath export. Importing from 'ltsv' will not include them.","wrong":"import { createLtsvToJsonStream } from 'ltsv'","symbol":"createLtsvToJsonStream","correct":"import { createLtsvToJsonStream } from 'ltsv/nodejs_stream'"}],"quickstart":{"code":"import * as ltsv from 'ltsv';\n\n// Parse LTSV string to array of objects\nconst parsed = ltsv.parse(\n  'label1:value1\\tlabel2:value2\\n' +\n    'label1:value3\\tlabel2:value4'\n);\nconsole.log(parsed);\n// [ { label1: 'value1', label2: 'value2' },\n//   { label1: 'value3', label2: 'value4' } ]\n\n// Format array of objects to LTSV string\nconst formatted = ltsv.format([\n  { label1: 'value1', label2: 'value2' },\n  { label1: 'value3', label2: 'value4' }\n]);\nconsole.log(formatted);\n// 'label1:value1\\tlabel2:value2\\nlabel1:value3\\tlabel2:value4'","lang":"typescript","description":"Parse and format LTSV data using the main module. Shows basic usage of parse and format functions."},"warnings":[{"fix":"Use import syntax or upgrade to Node >=20. If CommonJS needed, use v3.x (last CJS version).","message":"Package is ESM-only since v4. Node.js >=20 required. CommonJS require() will throw.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Import from 'ltsv/nodejs_stream' for createLtsvToJsonStream, createLtsvToObjectStream, etc.","message":"Stream functions are only available via 'ltsv/nodejs_stream' subpath import, not from main 'ltsv'","severity":"gotcha","affected_versions":"*"},{"fix":"Convert Buffer to string using .toString() or use stream for binary input.","message":"The parse() function expects a string. Passing a Buffer will cause type errors in TypeScript.","severity":"gotcha","affected_versions":"*"},{"fix":"Use named imports: import * as ltsv from 'ltsv' or import { parse } from 'ltsv'.","message":"The old CommonJS API (require('ltsv')) is removed in v4. Default export no longer exists.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Manually sanitize values or use strict mode validation before formatting.","message":"Values containing newline characters are not escaped in format(). Output may be invalid LTSV.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'20':18 '4.0.1':15 'definit':28 'design':39 'differenti':50 'effici':41 'esm':22 'esm-on':21 'format':32 'formatt':8,59 'full':25 'infrequ':47 'interfac':38 'javascript':58 'label':3 'log':43 'ltsv':1,2,42,60 'mode':56 'node':17 'node.js':13,36 'pars':30 'parselin':31 'parser':7,61 'process':44 'provid':29 'releas':45 'requir':16 'separ':5 'stabl':49 'stream':37,52,62 'strict':55 'support':53 'tab':4 'transformstream':11 'type':27 'typescript':26,64 'valid':9,33,57,63 'valu':6 'version':14","created_at":"2026-06-04T18:52:24.281792+00:00","updated_at":"2026-06-04T18:52:24.281792+00:00","problems":[{"fix":"Switch to import syntax or downgrade to ltsv@3 that supports CommonJS.","cause":"Using require() on ESM-only package v4.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/ltsv/dist/index.js from /path/to/app.js not supported."},{"fix":"Change import to: import { createLtsvToJsonStream } from 'ltsv/nodejs_stream';","cause":"Importing createLtsvToJsonStream from main 'ltsv' instead of 'ltsv/nodejs_stream'.","error":"SyntaxError: Named export 'createLtsvToJsonStream' not found. The requested module 'ltsv' is a commonjs module which may not support all module.exports as named exports."},{"fix":"Use import * as ltsv from 'ltsv' or import { parse } from 'ltsv'.","cause":"Using default import instead of namespace or named import.","error":"TypeError: ltsv.parse is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/sasaplus1/ltsv.js#readme","github":"https://github.com/sasaplus1/ltsv.js","docs":null,"changelog":null,"pypi":null,"npm":"ltsv","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}