UNPKG

torrent-to-pixeldrain

Version:

Allows you to download a torrent and upload it to pixeldrain.com

28 lines 905 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PixeldrainService = void 0; const pixeldrainjs_1 = require("pixeldrainjs"); class PixeldrainService { constructor(APIKey, writer) { this.pixeldrainClient = new pixeldrainjs_1.PixelDrain(APIKey); this.writer = writer; } uploadFile(path, name) { return new Promise((resolve, reject) => { this.pixeldrainClient.uploadFile({ path, name, anonymous: false }) .then((file) => { if (this.writer) { this.writer.append(`https://pixeldrain.com/u/${file.id}`); } resolve(file.id); }) .catch(reject); }); } } exports.PixeldrainService = PixeldrainService; //# sourceMappingURL=pixeldrainservice.js.map