forked from hibas123/SecureFileWrapper
Converting preview to base64 encoded string
This commit is contained in:
parent
9f8a60dba5
commit
e8d116121e
4
index.js
4
index.js
@ -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)];
|
||||
|
4
index.ts
4
index.ts
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user