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 🙏

© 2026 – Pkg Stats / Ryan Hefner

hg-ftp-deploy-cli

v1.0.2

Published

CLI tool to deploy local files to FTP server with automatic backup

Downloads

413

Readme

hg-ftp-deploy-cli

一个简单的 FTP 部署工具,支持将本地目录上传到 FTP 服务器,并自动备份远程已有目录。

安装

npm install hg-ftp-deploy-cli -g

或在项目内安装:

npm install hg-ftp-deploy-cli -D

CLI 使用

基本语法

ftp-deploy -l <本地目录> -r <远程目录> -h <主机> -u <用户名> -p <密码>

参数说明

| 参数 | 简写 | 说明 | 默认值 | |------|------|------|--------| | --user | -u | FTP 用户名(必填) | - | | --password | -p | FTP 密码(必填) | - | | --host | -h | FTP 服务器地址 | 139.224.201.130 | | --port | -P | FTP 服务器端口 | 21 | | --local-root | -l | 本地上传目录 | ./dist | | --remote-root | -r | 远程目标目录 | / | | --no-backup | - | 跳过备份已有远程目录 | 默认开启备份 | | --secure | - | 使用 FTPS(显式 TLS) | false | | --concurrency | -c | 并行上传连接数 | 3 | | --incremental | - | 跳过远程大小相同的文件 | false | | --no-progress | - | 隐藏上传进度条 | false | | --no-passive | - | 使用主动模式 | 默认被动模式 |

示例

部署 ./build 目录到远程 /sw-eam-ui

ftp-deploy -l ./build -r /sw-eam-ui -h 139.224.201.130 -u myuser -p mypassword

跳过备份直接覆盖:

ftp-deploy -l ./dist -r /my-app -u myuser -p mypassword --no-backup

使用 FTPS 连接:

ftp-deploy -l ./dist -r /my-app -u myuser -p mypassword --secure

在 package.json 中配置

{
  "scripts": {
    "deploy": "ftp-deploy -l ./dist -r /my-app -h example.com -u $FTP_USER -p $FTP_PASS"
  }
}

编程使用

支持作为模块在 Node.js 中调用:

import { uploadToFtp } from 'hg-ftp-deploy-cli';

await uploadToFtp({
  host: '139.224.201.130',
  port: 21,
  user: 'myuser',
  password: 'mypassword',
  localRoot: './dist',
  remoteRoot: '/my-app',
  backup: true,
  secure: false,
  concurrency: 5,          // 可选:并行连接数
  incremental: true,        // 可选:跳过未变化文件
  onProgress({ uploaded, total, currentFile }) {
    console.log(`${currentFile}: ${(uploaded / total * 100).toFixed(1)}%`);
  },
});

参数

| 字段 | 类型 | 说明 | 默认值 | |------|------|------|--------| | host | string | FTP 服务器地址(必填) | - | | port | number | FTP 端口 | 21 | | user | string | 用户名(必填) | - | | password | string | 密码(必填) | - | | localRoot | string | 本地目录路径(必填) | - | | remoteRoot | string | 远程目录路径 | / | | backup | boolean | 是否备份已有目录 | true | | secure | boolean | 是否使用 FTPS | false | | concurrency | number | 并行上传连接数 | 3 | | incremental | boolean | 跳过远程大小相同的文件 | false | | onProgress | function | 进度回调 ({ uploaded, total, currentFile }) | - |

功能特性

  • 并行上传 — 多连接并发上传,大幅提升大量文件的上传速度
  • 进度条 — 实时显示上传进度、速度和并发 Worker 数
  • 增量上传--incremental 模式下自动跳过远程大小相同的文件
  • 自动备份 — 上传前自动将远程已有同名目录重命名为 <目录名>_backup_<时间戳>

License

MIT