{"id":28030,"library":"parse-listing","title":"parse-listing","description":"Small library to parse file listings (e.g., ls, dir) into JavaScript objects. Currently at v1.1.3, last released in 2018 with a fix for MS-DOS folder names containing numbers. It supports Unix and DOS/Windows formats automatically. The library is stable but in maintenance mode; no new features are expected. Compared to alternatives, it is minimal and has no dependencies.","status":"maintenance","version":"1.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/sergi/parse-listing","tags":["javascript","parse","ls","list","listing","ftp","unix","dos"],"install":[{"cmd":"npm install parse-listing","lang":"bash","label":"npm"},{"cmd":"yarn add parse-listing","lang":"bash","label":"yarn"},{"cmd":"pnpm add parse-listing","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runs on Node.js >=0.6.21","package":"node","optional":false}],"imports":[{"note":"This package is CommonJS only; no ESM support.","wrong":"import Parser from 'parse-listing'; // Not ESM, use require","symbol":"Parser","correct":"const Parser = require('parse-listing');"},{"note":"parseEntries is async but uses callback, not Promises.","wrong":"Parser.parseEntries(str).then(callback); // Not promise-based","symbol":"parseEntries","correct":"Parser.parseEntries(str, callback);"},{"note":"parseEntry is synchronous and returns an object directly.","wrong":"Parser.parseEntry(str, callback); // parseEntry is synchronous","symbol":"parseEntry","correct":"const entry = Parser.parseEntry(str);"}],"quickstart":{"code":"const Parser = require('parse-listing');\n\nconst unixListing = `drwxr-xr-x    5 1001     1001         4096 Jan 09 11:52 .\ndrwxr-xr-x    4 0        0            4096 Sep 19 13:50 ..\n-rw-------    1 1001     1001         1118 Jan 09 12:09 .bash_history\n-rw-------    1 1001     1001          943 Jan 09 11:52 .viminfo\ndrwxrwxr-x    5 1001     1001         4096 Jan 09 11:52 inaccessible\ndrwxrwxrwx    2 1001     1001         4096 Sep 21 11:20 project1\ndrwx------    2 1001     1001         4096 Oct 19 16:17 project2`;\n\nParser.parseEntries(unixListing, function(err, entries) {\n  if (err) {\n    console.error(err);\n    return;\n  }\n  entries.forEach(function(entry) {\n    console.log('Name:', entry.name, 'Type:', entry.type, 'Size:', entry.size);\n  });\n});","lang":"javascript","description":"Parses a Unix 'ls -la' formatted string into objects, logging name, type, and size for each entry."},"warnings":[{"fix":"Always wrap in try-catch for parseEntry or check input validity before calling parseEntries.","message":"Callback error handling: if you pass invalid input (e.g., null or non-string), the library may throw synchronously or call callback with error depending on the method.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use a library like moment.js to parse the raw date string if needed; check entry.time for NaN.","message":"Time parsing: The 'time' field is a timestamp in milliseconds, but some entries may not parse correctly (e.g., non-standard date formats).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider switching to 'ftp-parse-listing' or writing a custom parser if you need active maintenance.","message":"No updates since 2018: The package is in maintenance-only mode. Security or compatibility issues may not be addressed.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'npm install parse-listing' and ensure require('parse-listing') is correct.","cause":"Package not installed or module path incorrect.","error":"Cannot find module 'parse-listing'"},{"fix":"Use const Parser = require('parse-listing'); instead of import.","cause":"Using import instead of require (ESM vs CJS).","error":"TypeError: Parser.parseEntries is not a function"},{"fix":"Ensure callback is a function: Parser.parseEntries(str, function(err, entries) { ... });","cause":"Passing undefined as callback to parseEntries.","error":"undefined is not a function (callback)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}