Registry / http-networking / ftp-response-parser

ftp-response-parser

JSON →
library1.0.1jsnpmunverified

The `ftp-response-parser` package provides a lightweight, streaming parser specifically designed for handling FTP server response format strings. It efficiently processes incoming FTP protocol messages, including multi-line responses, and emits structured JavaScript objects. Each emitted object includes the numeric status `code`, the full `text` of the response, and boolean flags `isMark` and `isError`. This library is currently at version 1.0.1, with its last update occurring over a decade ago. It functions as a classic Node.js `Stream` and is primarily differentiated by its low-overhead, event-driven approach to parsing continuous streams of FTP data, making it suitable for integration into custom FTP client implementations that require incremental response processing.

http-networkingdataserialization
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This package is CommonJS-only, exporting the `ResponseParser` class directly as the module's default export. Named imports or ESM default imports are not supported.

const ResponseParser = require('ftp-response-parser');

Demonstrates how to instantiate the `ResponseParser`, listen for `readable` events to process parsed FTP response objects, handle potential errors, and feed it a multi-line FTP response string, ensuring the stream is properly terminated.

const ResponseParser = require('ftp-response-parser'); const myParser = new ResponseParser(); myParser.on('readable', function() { let line; while ((line = myParser.read()) !== null) { console.log(`Code: ${line.code}, Text: ${line.text}`); } }); myParser.on('error', (err) => { console.error('Parser encountered an error:', err); }); myParser.on('end', () => { console.log('End of FTP response stream.'); }); // Example FTP multi-line response string const ftpResponse = `211-Features supported:\n EPRT\n EPSV\n MDTM\n MLST type*;perm*;size*;modify*;unique*;unix.mode;unix.uid;unix.gid;\n REST STREAM\n SIZE\n TVFS\n UTF8\n211 End FEAT.\n215 UNIX Type: L8\n331 Username ok, send password.\n230 Login successful.\n200 Type set to: Binary.\n250 "/test" is the current directory.\n`; myParser.write(ftpResponse); myParser.end(); // Signal that no more data will be written console.log('Parser initialized and example data sent.');
Debug
Known footguns
breakingThis package is CommonJS-only and does not provide an ESM export. Direct `import` statements (e.g., `import { ResponseParser } from 'ftp-response-parser';`) will result in a runtime error.
gotchaThe `ftp-response-parser` package is abandoned, with its last update occurring over a decade ago (May 2013). It may contain unaddressed bugs, security vulnerabilities, or compatibility issues with modern Node.js versions (e.g., Node.js v16+ and later).
gotchaAs a Node.js `Stream`, if the input stream is not explicitly ended (via `parser.end()`) after all data has been written, the parser might hold onto buffered data indefinitely, potentially leading to memory leaks or incomplete parsing of the final response segments.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
ahrefsbot
4
amazonbot
4
script
1
bingbot
1
Resources