Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Latest commit

 

History

History
71 lines (57 loc) · 2.97 KB

README.md

File metadata and controls

71 lines (57 loc) · 2.97 KB

ftp-service

A simple wrapper for a simpler FTP client surface API with pool and retry management.

GitHub license Coverage Status NPM version Dependency Status devDependency Status Package Quality Code Climate

This wrapper is directly usable with Knifecycle.

API

initFTPService(services) ⇒ Promise.<FTPService>

Instantiate the FTP service

Kind: global function
Returns: Promise.<FTPService> - A promise of the FTP service

Param Type Description
services Object The services to inject
services.FTP function The configuration object as given to basic-ftp client access method
services.FTP_CONFIG function The FTP service configuration object
[services.FTP_POOL] function The FTP pool configuration object as given to generic-pool.
services.FTP_TIMEOUT function The FTP service timeout as given to basic-ftp client constructor
[services.FTP_PASSWORD_ENV_NAME] function The environment variable name in which to pick-up the FTP password
[services.log] function A logging function
[services.time] function A function returning the current timestamp

Example

import initFTPService from 'ftp-service';
import { initDelayService } from 'common-services';

const delay = await initDelayService({
  log: console.log.bind(console),
})
const jwt = await initFTPService({
  FTP: {
    host: 'localhost',
    user: 'user',
    pasword: 'pwd',
  },
  FTP_CONFIG: { base: '' },
  delay,
  log: console.log.bind(console),
});

const files = await ftp.list('/);

Authors

License

MIT