Converting preview to base64 encoded string

This commit is contained in:
Fabian Stamm 2018-06-18 19:41:05 +02:00
parent 9f8a60dba5
commit e8d116121e
2 changed files with 4 additions and 4 deletions

View File

@ -214,7 +214,7 @@ var SecureFile = /** @class */ (function () {
case 0:
params = { type: type, name: name };
if (preview) {
params.preview = preview;
params.preview = preview.toString("base64");
}
if (folder) {
params.folder = folder;
@ -285,7 +285,7 @@ var SecureFile = /** @class */ (function () {
case 0:
put = {};
if (preview)
put.preview = preview;
put.preview = preview.toString("base64");
if (meta)
put.meta = meta;
return [4 /*yield*/, this.makeRequest("/files/" + id, "PUT", put, data, this.jwt_enabled)];

View File

@ -117,7 +117,7 @@ export default class SecureFile {
async create(name: string, data: Buffer, type: "text" | "binary", folder?: string, preview?: Buffer, meta?: string): Promise<File> {
let params: any = { type: type, name: name };
if (preview) {
params.preview = preview;
params.preview = preview.toString("base64");
}
if (folder) {
params.folder = folder;
@ -153,7 +153,7 @@ export default class SecureFile {
async update(id: string, data: Buffer, preview?: Buffer, meta?: string): Promise<File> {
let put: any = {};
if (preview) put.preview = preview;
if (preview) put.preview = preview.toString("base64");
if (meta) put.meta = meta;
let res = await this.makeRequest("/files/" + id, "PUT", put, data, this.jwt_enabled);
statusParser(res);