{"id":14089,"library":"table-parser","title":"Shell Table Parser","description":"table-parser is a Node.js library designed to parse tabular, shell-style output into structured JavaScript objects. Its primary function, `parse`, takes a string of data (like `ps` command output) and converts it into an array of objects, where each object represents a row and keys correspond to column headers. The current stable version is 1.0.1, released in 2018, and the project appears to be abandoned with no further updates or releases since then. This library differentiates itself through its minimalist approach and specific handling of quoted strings within a row; for example, a string like \"C:\\Program Files\\...\" will be treated as a single value, with the initial double quote removed. However, subsequent double quotes within a value are preserved. By default, values are split into arrays by whitespace unless enclosed in quotes. Due to its age, `table-parser` lacks support for modern JavaScript module systems like ESM and may not be compatible with newer Node.js versions or environments without CommonJS support. It offers a simple, unopinionated way to process predictable shell outputs, but users should be aware of its lack of ongoing maintenance and potential limitations for complex parsing needs or evolving data formats.","status":"abandoned","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/neekey/table-parser","tags":["javascript","table parser shell"],"install":[{"cmd":"npm install table-parser","lang":"bash","label":"npm"},{"cmd":"yarn add table-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add table-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only (published in 2018) and does not natively support ES Modules. Attempting to use `import` directly will result in a runtime error.","wrong":"import Parser from 'table-parser';","symbol":"Parser","correct":"const Parser = require('table-parser');"},{"note":"The `parse` function is a method of the default exported `Parser` object, not a named export. It must be accessed as a property of the `Parser` object.","wrong":"import { parse } from 'table-parser';","symbol":"Parser.parse","correct":"const Parser = require('table-parser');\nconst parsedData = Parser.parse(data);"}],"quickstart":{"code":"const FS = require('fs');\nconst Parser = require('table-parser');\n\n// Simulate a shell output file\nconst mockLogContent = `  PID TTY           TIME CMD\n49692 ttys000    0:00.06 login -pfl neekey /bin/bash -c exec -la bash /bin/bash\n49693 ttys000    0:00.06 -bash\n54195 ttys000    0:00.09 node run\n56266 ttys005    0:00.06 login -pfl neekey /bin/bash -c exec -la bash /bin/bash\n56269 ttys005    0:00.04 -bash\n56463 ttys005    0:00.09 node test.js\n56464 ttys005    0:00.01 ps -a`;\n\n// In a real scenario, you would read from a file:\n// const data = FS.readFileSync('./ps.log').toString();\n\nconst parsedData = Parser.parse(mockLogContent);\n\nconsole.log(parsedData);","lang":"javascript","description":"Demonstrates parsing a multi-line string resembling `ps` command output into an array of JavaScript objects."},"warnings":[{"fix":"For new projects, consider using a more actively maintained parsing library. If you must use `table-parser`, thoroughly test its behavior in your target environment and be aware of potential limitations.","message":"The `table-parser` package has not been updated since April 2018, indicating it is likely abandoned. This means it may have compatibility issues with newer Node.js versions, unresolved bugs, or potential security vulnerabilities.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"In an ESM project, you must use a compatibility wrapper like `createRequire` from the `module` built-in module: `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const Parser = require('table-parser');`","message":"This package is CommonJS-only. It does not natively support ES Modules (`import`/`export` syntax). Attempting to import it directly in an ESM project will cause a runtime error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always inspect the `parsedData` output carefully to understand how your specific input strings are being processed. Be prepared to implement post-processing logic to adjust the parsed values if they don't meet your exact requirements.","message":"The parser has specific and potentially counter-intuitive handling for double-quoted strings. If a string starts with a double quote, that initial quote is removed. However, double quotes occurring elsewhere within the string are preserved, and all values are treated as arrays of strings by default.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':61 '2018':64 'abandon':71 'age':143 'appear':68 'approach':87 'array':41,133 'awar':185 'c':102 'column':54 'command':34 'commonj':168 'compat':160 'complex':196 'convert':37 'correspond':52 'current':57 'data':31,201 'default':128 'design':11 'differenti':82 'doubl':115,120 'due':140 'enclos':137 'environ':166 'esm':155 'evolv':200 'exampl':98 'file':104 'format':202 'function':25 'handl':90 'header':55 'howev':118 'initi':114 'javascript':21,151,203 'key':51 'lack':147,188 'librari':10,81 'like':32,101,154 'limit':194 'mainten':191 'may':157 'minimalist':86 'modern':150 'modul':152 'need':198 'newer':162 'node.js':9,163 'object':22,43,46 'offer':171 'ongo':190 'output':18,35,180 'pars':13,26,197 'parser':3,6,146,205 'potenti':193 'predict':178 'preserv':126 'primari':24 'process':177 'program':103 'project':67 'ps':33 'quot':92,116,121,139 'releas':62,77 'remov':117 'repres':47 'row':49,96 'shell':1,16,179,206 'shell-styl':15 'simpl':173 'sinc':78 'singl':110 'specif':89 'split':131 'stabl':58 'string':29,93,100 'structur':20 'style':17 'subsequ':119 'support':148,169 'system':153 'tabl':2,5,145,204 'table-pars':4,144 'tabular':14 'take':27 'treat':107 'unless':136 'unopinion':174 'updat':75 'user':182 'valu':111,124,129 'version':59,164 'way':175 'whitespac':135 'within':94,122 'without':167","created_at":"2026-04-20T01:57:52.886145+00:00","updated_at":"2026-04-20T01:57:52.886145+00:00","problems":[{"fix":"Ensure you are correctly requiring the package and calling `parse` as a method of the returned `Parser` object: `const Parser = require('table-parser'); const parsedData = Parser.parse(data);`","cause":"The `parse` method is being called on an undefined or incorrect object, often due to a mistaken import pattern or failed `require`.","error":"TypeError: Parser.parse is not a function"},{"fix":"Use the CommonJS `require()` function: `const Parser = require('table-parser');` If you are in an ES Module context and absolutely need to load it, use `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const Parser = require('table-parser');`","cause":"Attempting to use ES Module `import` syntax to load a CommonJS-only package in an environment that is not configured for Node.js's ESM compatibility.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/neekey/table-parser","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/table-parser","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}