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-core

v0.0.7

Published

something like the levelup core

Downloads

28

Readme

ftp-core Build Status

A minimal, hopefully unopinionated implementation of FTP in JavaScript.

This is a work-in-progress.

The goal is to provide the most minimum (but complete) framework needed to have a functional FTP object.

Commands like USER and CWD are part of the "core" FTP specs (i.e., see RFC 959), but even they are not implemented in the core.

Each FTP command--also called an "extension"--is a distinct npm module, and you call the different modules to extend this core module, e.g. something like this:

var Ftp = require('ftp-core')
var FtpUser = require('ftp-extension-user')
var Socket = require('ftp-normal-sockets')

var myFtp = new Ftp()
	.extend(FtpUser())
	.extend(Socket({ listen: 21 }))

The goal

The goal with this core, and with the main extensions developed to make it useful, is this:

  1. Keep it simple enough (or "well abstracted", possibly) so that a developer can read through each module to see what the FTP RFC actually requires, programmatically.
  2. Don't require an FS for the backend. (Should be able to easily use something like levelup or even a browser's local storage.)
  3. Implementing existing or new FTP extensions should be easy and sensible. Adding an extension should be as easy as making a new levelup extension, or even easier.
  4. Don't require OS/node socket literals. (Should be able to create a thin wrapper for the socket implementation that uses the OS/node sockets, or one that uses WebSockets, or anything else.)

Road map thingy

  • Get a primary group of extensions created and thoroughly tested, so that we can see what parts of the internal API are missing.
  • The goal of these primary extensions is whatever is needed to create a functional anonymous FTP server. User authentication is not a primary extension.
  • For each of the primary extensions, create them as npm modules, and make two kinds of tests:
    1. tests that are generic, and re-usable in any other module, to see if the extension is RFC compliant
    2. tests that functionally validate the actual extension

According to RFC 5797 (which I understand to have superseded RFC 959) the "base FTP commands" are:

  • Mandatory:
    • ABOR
    • ACCT
    • ALLO
    • APPE
    • CWD
    • DELE
    • HELP
    • LIST
    • MODE
    • NLST
    • NOOP
    • PASS
    • PASV
    • PORT
    • QUIT
    • REIN
    • REST
    • RETR
    • RNFR
    • RNTO
    • SITE
    • STAT
    • STOR
    • STRU
    • TYPE
    • USER
  • Optional:
    • CDUP
    • MKD
    • PWD
    • RMD
    • SMNT
    • STOU
    • SYST

However, the primary extensions are, as I see them:

  • USER
  • FEAT
  • CWD
  • PWD
  • LIST / MLSD / MLST (are these all the same?)
  • PASV / EPSV / PORT (LPSV and LPRT are obsolete, according to RFC 5797)
  • NOOP
  • QUIT
  • RETR
  • REST
  • SIZE
  • STAT
  • TYPE

As soon as all that is done, the next goal would be getting AUTH working.

Getting AUTH TLS / AUTH SSH working and tested is going to be rather tricky, I feel, but hopefully it can be abstracted away enough to be easy-ish...

It would probably also be good to make a very simple USER/PASS extension that uses levelup for the user database? I don't personally have a use for it, but I imagine others might find it useful.

Get involved?

you could make issues, if you think of something that is missing

or you could contribute code, if you've got some free time

I'm pretty easy to work with, and I like community!

Developer notes

It is up to the developer to generate valid FTP strings as responses inside extensions. If you are doing normal string responses, you can use something like ftp-generate-response to make RFC compliant responses.

Internally, we may make use of something like ftp-validate-response to verify that all response strings are RFC compliant. This isn't being done now, but it might be added in the future?

License

VOL