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

@guestbell/fast-ftp

v1.0.8

Published

Supercharge your ftp deployments

Downloads

11

Readme

Supercharge your ftp deployments with fast-ftp.

Benchmark

Uploading guestbell.com - ~500 files, 27 directories some 5 levels deep

| | Time taken | Improvement | | :----------------------------------------------------: | :--------: | :---------: | | basic-ftp | 217sec | 10x | | ftp-deploy | 197sec | 9x | | fast-ftp | 22sec | 1x |

Why is it fast?

Ftp doesn't support parallel operations on a single connections. But you can usually spawn many connections. fast-ftp does that + leverages optimized algorithms to increase speed of common tasks like uploading whole directories, deleting whole directories etc.

Standard use-case

Fast ftp was made to accelerate uploading static sites - 1 directory with many files (we also expose api for custom use-cases). We also want the site to work during deployment - to not enter a broken state. How can that happen? If you first delete the whole site and then start uploading or simply just sync directories. Both of these can lead to broken sites if user navigates to it at a wrong moment.

How it works?

  1. Directory is first uploaded to temp ftp directory
  2. Site directory is renamed to old ftp directory
  3. Temp ftp directory is renamed to site directory

This way the downtime is close to 0 and there's not risk of broken sites.

Getting Started

  1. Installation:
npm @guestbell/fast-ftp
# or
yarn @guestbell/fast-ftp
  1. Config Ftp Client

Fast-ftp reads ftp client config (sensitive) from environment variables.

These are required: FTP_HOST FTP_USERNAME FTP_PASSWORD These are optional: FTP_PORT FTP_SECURE

We also support deploy.env config file. Sample follows:

FTP_HOST=example.com
FTP_USERNAME=johndoe
FTP_PASSWORD=secret
  1. Config deployment script

This is done by command line parameters:

These are required: --remote-root Directory path on ftp --local-root Directory path on local machine These are optional: --tmp-root Temporary directory path on ftp - defaults to 'remote-root'+'-tmp' --old-root Old directory path on ftp - defaults to 'remote-root'+'-old' --concurrency How many connections to spawn

  1. Run the script
fast-ftp --remote-root=/sub/example --local-root=/path-to-published

Api

We provide accelerated ftp functions and helpers you can use in your pipeline or node-js projects.

General idea is you first use getClients function to obtain an array of ftp-clients (connections). These are then passed to other functions. Check the main deployment script as an example.

Full api docs here

Created and sponsored by

  • GuestBell - Customer centric online POS for Hotels and short terms stays.

Contributing

  1. Fork it
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

License

MIT