var Client = require('ftp') module.exports = { init() { if (!this._client) { this._client = new Client() this._client.on('ready', function() { console.log('[FTP client] ready') }) this._client.connect({ host: '140.143.198.31', user: 'dalmatian', password: 'kjlsahjds772SHJ' }) } }, upload(filePath, destPath) { return new Promise((resolve, reject) => { this._client.put(filePath, destPath, function(err) { if (err) { return reject && reject(err) } resolve() }) }) } }