{"id":17195,"library":"curl-trace-parser","title":"cURL Trace Parser","description":"curl-trace-parser is a Node.js package designed to parse the output generated by the `curl` command-line tool when using its `--trace` or `--trace-ascii` options. It extracts raw HTTP request and response messages from curl's custom trace format, which otherwise presents data in fragmented chunks. This utility is particularly useful for debugging or introspecting HTTP communication of RESTful APIs without resorting to lower-level tools like tcpdump or Wireshark. It offers output in a raw HTTP message format or an API Blueprint format. The package is at version 0.0.10 and appears to be abandoned, with no recent updates or a clear release cadence. Its key differentiator is simplifying the often complex task of interpreting curl's trace output into structured HTTP messages.","status":"abandoned","version":"0.0.10","language":"javascript","source_language":"en","source_url":"git://github.com/apiaryio/curl-trace-parser","tags":["javascript","curl","parse","trace","raw","http","message","request","repsponse"],"install":[{"cmd":"npm install curl-trace-parser","lang":"bash","label":"npm"},{"cmd":"yarn add curl-trace-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add curl-trace-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports an already instantiated parser (an EventEmitter) as its default CommonJS export. It is not a class to be `new`d or a named export.","wrong":"import { parser } from 'curl-trace-parser';","symbol":"parserInstance","correct":"const parser = require('curl-trace-parser');"},{"note":"The `--raw` and `--blueprint` formatting options are primarily exposed via the command-line interface, not directly through the programmatic API (which focuses on parsing events).","wrong":"require('curl-trace-parser').raw(data)","symbol":"CLI usage (raw format)","correct":"cat tracefile | curl-trace-parser --raw"}],"quickstart":{"code":"const fs = require('fs');\nconst { Writable } = require('stream');\nconst parser = require('curl-trace-parser');\n\n// Simulate curl --trace output from a file\nconst traceData = fs.readFileSync('trace.log', 'utf8');\n\n// Create a custom writable stream to capture parsed output\nlet rawOutput = '';\nconst customWriter = new Writable({\n  write(chunk, encoding, callback) {\n    rawOutput += chunk.toString();\n    callback();\n  }\n});\n\n// Pipe the parser's raw output to our custom writer\nparser.pipe(customWriter);\n\nparser.on('request', (req) => {\n  console.log('--- Parsed Request ---');\n  // For programmatic access, you would process the 'req' object\n  // The 'req' object itself might contain structured data or just the raw lines depending on internal implementation\n});\n\nparser.on('response', (res) => {\n  console.log('--- Parsed Response ---');\n  // For programmatic access, you would process the 'res' object\n});\n\n// Feed the trace data line by line to the parser\ntraceData.split('\\n').forEach(line => {\n  parser.execute(line);\n});\n\nparser.end(); // Signal end of input\n\n// After processing all lines, the rawOutput will contain the parsed HTTP messages\nconsole.log('\\n--- Raw HTTP Output from Parser Stream ---');\nconsole.log(rawOutput);","lang":"javascript","description":"Demonstrates programmatic usage of `curl-trace-parser` by reading a mock trace file, feeding its lines to the parser's `execute` method, listening for 'request' and 'response' events, and piping the parser's transformed output to a custom stream to collect the raw HTTP messages."},"warnings":[{"fix":"Due to its pre-1.0 status and apparent abandonment, consider this package for experimental use only. Avoid in production systems where stability is critical, or be prepared to fork and maintain it yourself.","message":"The package version 0.0.10 indicates it is pre-1.0 and highly unstable. Expect frequent, undocumented breaking changes if development were to resume. Functionality or API signatures could change without adhering to semantic versioning.","severity":"breaking","affected_versions":"<=0.0.10"},{"fix":"Thoroughly test compatibility with your Node.js version and cURL output. If you encounter issues, you will likely need to debug and fix them yourself or seek alternative solutions.","message":"The project appears to be abandoned. Its repository badges (Travis CI, David-DM, Greenkeeper) are outdated, and the last commit activity and version suggest no active maintenance. This implies no support for newer Node.js versions, cURL trace format changes, or security fixes.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Always import using `const parser = require('curl-trace-parser');` to get the pre-instantiated parser instance. Listen to events like `parser.on('request', ...)` and `parser.on('response', ...)`.","message":"The package exports an instance of `Parser` directly, which is an `EventEmitter`. Attempting `new Parser()` or expecting named exports will fail.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Regularly verify parser output with your specific cURL version if relying on this tool in a critical workflow. Be prepared for manual adjustments or to find alternatives if cURL's trace format evolves.","message":"The parser relies on cURL's `--trace` output format. If future cURL versions significantly alter this format, `curl-trace-parser` may break without warning or updates.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"The package exports a pre-instantiated `EventEmitter` instance directly. Use `const parser = require('curl-trace-parser');` and then `parser.on(...)`.","cause":"Attempting to `new` the exported `Parser` or trying to access it as a class, instead of using the pre-instantiated EventEmitter.","error":"TypeError: parser.on is not a function"},{"fix":"Ensure `parser.end()` is called only after all trace lines have been processed by `parser.execute(line)` to correctly signal the end of input.","cause":"This error typically occurs when feeding data into a stream after it has been explicitly ended, for example, by calling `parser.end()` too early.","error":"Error: stream.push() after EOF"},{"fix":"Run `npm install curl-trace-parser` in your project directory, or `npm install -g curl-trace-parser` if you intend to use its CLI globally.","cause":"The package is not installed or not available in the current project's `node_modules`.","error":"Error: Cannot find module 'curl-trace-parser'"}],"ecosystem":"npm","meta_description":null}