npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ftp-generate-response

v0.0.5

Published

Generate RFC conforming response strings for an FTP server.

Downloads

2

Readme

ftp-generate-response

Generate RFC conforming strings for an FTP server connection.

Install the normal node way.

Use like this:

var generate = require('ftp-generate-response')
var lines = [
	'Welcome to the server.',
	'Contact an admin for help.',
	'Vist the IRC at #our-site'
]
var output = generate(220, lines)

For which the expected output would be:

220-Welcome to the server
 Contact an admin for help.
220 Visit the IRC at #our-site

It is possible to specify a different string to prepend multi-line strings, e.g. like this:

var generate = require('ftp-generate-response')
var lines = [
	'Welcome to the server.',
	'Contact an admin for help.',
	'Vist the IRC at #our-site'
]
var output = generate(220, lines, '    ')

For which the expected output would be:

220-Welcome to the server
    Contact an admin for help.
220 Visit the IRC at #our-site

Notes on a common style

The following response style is found in many FTP server implementations:

220-Welcome to the server
220-Contact an admin for help.
220 Visit the IRC at #our-site

Strictly speaking, according to the RFC this is not acceptable:

If an intermediary line begins with a 3-digit number, the Server must pad the front to avoid confusion.

The reason the above style is interpreted by clients correctly is because the RFC also states:

The user-process then simply needs to search for the second occurrence of the same reply code, followed by (Space), at the beginning of a line, and ignore all intermediary lines.

This means that the above message would (after parsing) become:

Welcome to the server\r\n220-Contact an admin for help.\r\nVisit the IRC at #our-site

Additionally, although the RFC states that the Server must pad, it is unclear what padding is required. The example in the RFC pads the intermediary lines with <SP><SP>, but does not require it.

Although many FTP clients will interpret the above string correctly, we recommend to not use this style and instead pad with <SP><SP> on all intermediary lines, as shown in the RFC.

Multi-line messages contructed in this way will look like:

220-Welcome to the server
  Contact an admin for help.
220 Visit the IRC at #our-site

Parsing this can trim all <SP> characters at the start of each line, generating the following usable string:

Welcome to the server\r\nContact an admin for help.\r\nVisit the IRC at #our-site

License

VOL