Document parameters of CDN methods

This commit is contained in:
Roj Serbest 2021-10-21 20:33:13 +03:00
parent 1bb6e0d01b
commit 2eb89d0400
1 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,11 @@ import { formFromObj } from "../utils.ts";
import { MethodBase } from "./method_base.ts";
export class CDN extends MethodBase {
/**
* Uploads a file.
*
* @param document The file, it can be a buffer or a readable stream.
*/
async upload(document: any): Promise<Document> {
const form = formFromObj({
action: "upload",
@ -13,6 +18,12 @@ export class CDN extends MethodBase {
return (await this.client.invokeCDNRequest(form)).results;
}
/**
* Downloads the provided document.
*
* @param document The ID or instance of the document.
* @param stream Wheather to download and returns its data or stream it, returning a `Blob`.
*/
async download(document: string | Document, stream?: boolean) {
const form = formFromObj({
action: "download",