Dicer is a high-performance streaming multipart parser specifically designed for Node.js environments. It excels at efficiently processing `multipart/form-data` streams, making it suitable for handling HTTP file uploads and other multipart-encoded data with a focus on speed and low memory usage. The current stable version, 0.3.1, indicates a mature but not aggressively changing codebase. While it doesn't adhere to a rapid release cadence, its stability and proven performance make it a reliable choice for its specialized task. A key differentiator is its low-level, event-driven streaming API, providing developers with fine-grained control over the parsing process and part handling, contrasting with higher-level form parsing libraries that might buffer entire data sets. This design choice contributes to its reported efficiency and minimal memory footprint, especially beneficial for high-throughput applications where large file uploads are common. Benchmarks highlight its speed against alternatives, positioning it as a performant solution in the Node.js ecosystem.
npm install dicerVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to set up an HTTP server to receive multipart/form-data POST requests, manually extract the boundary from the `Content-Type` header, and use Dicer to parse individual parts, logging their headers and data.
Implement robust `Content-Type` header parsing (e.g., using a regex) to extract the `boundary` parameter, and pass it to the `Dicer` constructor: `new Dicer({ boundary: extractedBoundary })`.If expecting many headers per part, explicitly set `maxHeaderPairs` to a higher value in the `Dicer` constructor: `new Dicer({ boundary: '...', maxHeaderPairs: 5000 })`.Always attach a 'data' listener or pipe `PartStream` instances to another Writable stream. If you only need headers, ensure you call `p.resume()` on the `PartStream` to discard data and prevent backpressure buildup.
Ensure `Dicer` is correctly imported as a CommonJS module: `const Dicer = require('dicer');` or handled with appropriate ESM interoperability for a CJS module.Double-check the regex or logic used to extract the `boundary` string from the `Content-Type` HTTP header and ensure it is passed correctly to `new Dicer({ boundary: '...' })`. The boundary must be an exact match.No dependency data recorded yet.