site-ftp

Upload project file to FTP site. 上传项目文件到FTP站点。

Usage no npm install needed!

<script type="module">
  import siteFtp from 'https://cdn.skypack.dev/site-ftp';
</script>

README

Instructions

  • 上传项目文件到FTP站点
  • Upload project file to FTP site

Install

npm install site-ftp --save-dev
  • create a file ftp.js
const { SiteFtp } = require('site-ftp');
SiteFtp.connect({
    "host": "localhost",
    "port": 21,
    "username": "anonymous",
    "password": "anonymous@",
    "type": "ftp",
    "from": ["dist/**"],
    "to": "/public_html/",
    "rm": true
});
  • run node
node ftp.js
  • console √ Finished!
i {"host":"","port":21,"username":"","password":"","type":"ftp","from":["dist/**","src"],"to":"/public_html/","rm":true}
i Connecting...
i Deleting the ftp folder`/public_html/`
√ Successfully deleted the ftp folder`/public_html/`
i Uploading...
√ Finished!

Default Options

{
    "host": "localhost",
    "port": 21,
    "username": "anonymous",
    "password": "anonymous@",
    "type": "ftp",
    "from": ["dist/**"],
    "to": "/public_html/",
    "rm": true
}

TypeScript Options

export declare namespace SiteFtp {
    interface SiteFtpOptions {
        host?: string;
        port?: number;
        username?: string;
        password?: string;
        type?: string;
        from?: Array<string>;
        to?: string;
        rm?: boolean | string;
    }
    export function connect(options: SiteFtpOptions): void;
    export {};
}