lbry.tech/helpers/upload-image.js
2018-08-07 18:15:34 -05:00

29 lines
537 B
JavaScript

"use strict";
// P A C K A G E
const request = require("request-promise-native");
// E X P O R T
module.exports = exports = imageSource => new Promise((resolve, reject) => {
request({
body: imageSource,
headers: {
"Content-Type": "text/plain"
},
method: "PUT",
qs: {
access_token: process.env.LBRY_DAEMON_ACCESS_TOKEN
},
url: "http://daemon.lbry.tech/images.php"
}, (error, response, body) => {
if (error) reject(error);
body = JSON.parse(body);
resolve(body);
});
});