Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@winner-fed/ftp-deploy

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@winner-fed/ftp-deploy

FTP uploads local files to the target server

npmnpm
Version
4.0.5
Version published
Maintainers
1
Created
Source

ftp-deploy

配置说明

interface UserConfig {
  /**
   * 目标服务器登录用户
   */
  user: string;
  /**
   * 目标服务器登录密码
   */
  password: string;
  /**
   * 目标服务器主机地址,ftp 常用端口为21,sftp 为 22
   */
  host: string;
  /**
   * 目标服务器端口
   */
  port: number;
  /**
   * 本地路径
   */
  localPath: string;
  /**
   * 目标服务器上传路径
   */
  remotePath: string;
  /**
   * 包含的文件
   */
  // ["*.php", "dist/*", ".*"]
  include: Array<string>;
  /**
   * 不包含的文件
   **/
  // [
  //  "dist/**/*.map",
  // "node_modules/**",
  // "node_modules/**/.*",
  // ".git/**",
  // ]
  exclude: Array<string>;
  /**
   * 上传之前,删除目标服务器路径的所有文件
   * @default false
   */
  deleteRemote: boolean;
  /**
   * @default true
   */
  forcePasv: boolean;
  /**
   * 使用 sftp 或 ftp
   * @default false
   */
  sftp: boolean;
}

使用说明

const { FtpDeployer } = require('@winner-fed/ftp-deploy');
const path = require('path');

const ftpDeploy = new FtpDeployer();
const config = {
  localPath: path.join(__dirname, '/resource'),
  remotePath: '/usr/local/nginx/html/deploy-test',
  user: '***',
  password: '****',
  host: '****',
  port: 22,
  // include: ["*", "**/*"],      // this would upload everything except dot files
  include: ['*'],
  // e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)
  exclude: ['dist/**/*.map', 'node_modules/**', 'node_modules/**/.*', '.git/**'],
  // delete ALL existing files at destination before uploading, if true
  deleteRemote: false,
  // Passive mode is forced (EPSV command is not sent)
  forcePasv: true,
  // use sftp or ftp
  sftp: true
};

ftpDeploy
  .deploy(config)
  .then((res) => console.log('上传成功:', res))
  .catch((err) => console.log(err));

FAQs

Package last updated on 02 Dec 2022

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