Node.js native module to get file from FTP, FTPS and SFTP sources.
- Easy to install
- Easy to use. Just single async function: "getFile".
- 0 npm package dependencies
Get file from the ftp server (index.mjs)
import { getFile } from "@tpisto/ftp-any-get"
async function main() {
// Fetch from FTP server
let ftpFile = await getFile("ftp://demo:[email protected]/my-file.txt");
// Fetch from FTP server using TLS
let ftpsFile = await getFile("ftps://demo:[email protected]/my-file.txt");
// Fetch file using SFTP. SFTP runs over the SSH protocol.
let sftpFile = await getFile("sftp://demo:[email protected]/my-file.txt");
}
main();
If you want to accept_invalid_certs 😮, you can disable cert checks by adding "accept_invalid_certs" parameter to function.
import { getFile } from "@tpisto/ftp-any-get"
async function main() {
// Fetch from FTP server using TLS and use "danger_accept_invalid_certs"
let ftpsFile = await getFile("ftps://demo:[email protected]/my-file.txt", true);
}
main();
npm install @tpisto/ftp-any-get
or
yarn add @tpisto/ftp-any-get
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: SecureError("error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1914: (unable to get local issuer certificate)")', src/ftp_ftps.rs:24:8
node12 | node14 | node16 | |
---|---|---|---|
macOS x64 | ✓ | ✓ | ✓ |
macOS aarch64 | ✓ | ✓ | ✓ |
Linux x64 gnu | ✓ | ✓ | ✓ |
Linux aarch64 gnu | ✓ | ✓ | ✓ |