How to use the ftp.default function in ftp

To help you get started, we’ve selected a few ftp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openaq / openaq-fetch / adapters / airnow-ftp.js View on Github external
const getObjects = function (url, file, lineToObj, cb) {
  const ftp = new FTP();
  ftp.on('ready', () => {
    ftp.get(file, (err, stream) => {
      if (err) {
        return cb(err);
      }
      let objects = [];
      const lines = byline.createStream(stream, { encoding: 'utf8' });
      stream.once('close', function () {
        ftp.end();
        cb(null, objects);
      });
      lines.on('data', function (line) {
        line = line.split('|');
        objects.push(lineToObj(line));
      });
    });

ftp

An FTP client module for node.js

MIT
Latest version published 10 years ago

Package Health Score

68 / 100
Full package analysis