[[oktatas:web:nodejs|< Node.js]]
====== Node.js - ftp-deploy ======
* **Szerző:** Sallai András
* Copyright (c) 2024, Sallai András
* Szerkesztve: 2024
* Licenc: [[https://creativecommons.org/licenses/by-sa/4.0/|CC BY-SA 4.0]]
* Web: https://szit.hu
===== Bevezetés =====
FTP kliens.
Webhely:
* https://www.npmjs.com/package/ftp-deploy
===== Telepítés =====
npm install --save-dev ftp-deploy
npm install dotenv
===== Használat =====
FTP_HOST=valahol
FTP_USER=valaki
FTP_PASSWORD=titok
require('dotenv').config();
const FtpDeploy = require("ftp-deploy");
const ftpDeploy = new FtpDeploy();
const config = {
host: process.env.FTP_HOST,
user: process.env.FTP_USER,
password: process.env.FTP_PASSWORD,
port: 21,
localRoot: __dirname + "/src",
remoteRoot: "/htdocs/ber/",
include: ["*", "**/*"], // this would upload everything except dot files
// include: ["*.php", "dist/*", ".*"],
deleteRemote: true,
forcePasv: true,
sftp: false,
};
ftpDeploy
.deploy(config)
.then((res) => console.log("finished:", res))
.catch((err) => console.log(err));