UNPKG

ab-helpers

Version:

A collection of helper functions for various tasks

16 lines (13 loc) 453 B
const SFTPClient = require("ssh2-sftp-client"); async function send({ host, port, username, password }, buffer, remotePath) { try { const Client = new SFTPClient(); const config = { host, port, username, password }; await Client.connect(config); const result = await Client.put(Buffer.from(buffer), remotePath); return { result: result }; } catch (error) { return { error: error.message }; } } module.exports = { send };