Fetching Files from FTP via Node.js

Viewed 33

I'm trying to fetch files inside a directory I have on a web server. I'm using an npm called "basic-ftp" and I'm only able to see the directories but not the file inside of them.

  const client = new ftp.Client();
  client.ftp.verbose = true;
  try {
    await client.access({
      host: "195.201.166.237",
      port: "21",
      user: "******",
      password: "*******",
    });
    const ultracell = await client.list(
      "public_html/DB_download_Asso/ULTRACELL/"
    );
    console.log(ultracell[0]);
  } catch (err) {
    console.log(err, "Error");
  }

  client.close();
}

FTPfetch();

When I'm at the previous parent directory I can see all the folders inside, but when I try to open the last parent one I'm not able to see some pdf file that are located there.

Anyone knows how can I fetch those pdf files? Or better, show them to the client side?

0 Answers
Related