Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ftp-response-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ftp-response-parser

Parser for FTP server responses

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
299K
increased by4.83%
Maintainers
1
Weekly downloads
 
Created
Source

ftp-response-parser

This module provides a fast, lightweight streaming parser for FTP response format strings.

Given a string like this:

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\n
211 End FEAT.\n
215 UNIX Type: L8\n
331 Username ok, send password.\n
230 Login successful.\n
200 Type set to: Binary.\n
250 "/test" is the current directory.\n

it will stream the following objects:

{
  code: 211,
  text: '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.',
  isMark: false,
  isError: false
}
{
  code: 215,
  text: '215 UNIX Type: L8',
  isMark: false,
  isError: false
}
{
  code: 331,
  text: '331 Username ok, send password.',
  isMark: false,
  isError: false
}
{
  code: 230,
  text: '230 Login successful.',
  isMark: false,
  isError: false
}
{
  code: 200,
  text: '200 Type set to: Binary.',
  isMark: false,
  isError: false
}
{
  code: 250,
  text: '250 "/test" is the current directory.',
  isMark: false,
  isError: false
}

Usage


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

var myParser = new ResponseParser();

myParser.on('readable', function() {
  var line;
  while (line = myParser.read()) {
    console.log(line.code); // will emit 215
  }
});

myParser.write('215 UNIX Type: L8');

Install

To get the module, with npm do:

npm install ftp-response-parser

Test

With npm do:

npm test

License

MIT

Keywords

FAQs

Package last updated on 30 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc