pixeldrainjs
Version:
A NodeJS Wrapper for the pixeldrain.com API
63 lines • 1.96 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PixeldrainFile = void 0;
class PixeldrainFile {
/**
* Creates an instance of PixeldrainFile.
* @param {PixeldrainFileInformation} data File Information
* @param {PixeldrainService} pixeldrainService Pixeldrain API Service
* @memberof PixeldrainFile
*/
constructor(data, pixeldrainService) {
this.description = "";
this.pixeldrainService = pixeldrainService;
({
id: this.id,
name: this.name,
size: this.size,
views: this.views,
bandwidth_used: this.bandwidth_used,
bandwidth_used_paid: this.bandwidth_used_paid,
downloads: this.downloads,
date_upload: this.date_upload,
date_last_view: this.date_last_view,
mime_type: this.mime_type,
thumbnail_href: this.thumbnail_href,
hash_sha256: this.hash_sha256,
can_edit: this.can_edit,
description: this.description
} = data);
}
/**
* Deletes the file
*
* @return {*} {Promise<void>}
* @memberof PixeldrainFile
*/
delete() {
return new Promise((resolve, reject) => {
this.pixeldrainService.deleteFile(this.id)
.then(resolve)
.catch(reject);
});
}
/**
* Downloads the File
*
* @param {string} path Location to be downloaded
* @return {*} {Promise<void>}
* @memberof PixeldrainFile
*/
download(path) {
return new Promise((resolve, reject) => {
this.pixeldrainService.downloadFile(path, this.id)
.then(resolve)
.catch(reject);
});
}
downloadThumbnail(path) {
throw new Error("Method not implemented.");
}
}
exports.PixeldrainFile = PixeldrainFile;
//# sourceMappingURL=file.js.map