@staticbackend/backend 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend.d.ts +5 -1
- package/dist/backend.js +13 -1
- package/package.json +1 -1
package/dist/backend.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare class Backend {
|
|
|
97
97
|
ok: boolean;
|
|
98
98
|
content: any;
|
|
99
99
|
}>;
|
|
100
|
-
storeFile(token: string,
|
|
100
|
+
storeFile(token: string, buf: ArrayBuffer): Promise<{
|
|
101
101
|
ok: boolean;
|
|
102
102
|
content: any;
|
|
103
103
|
}>;
|
|
@@ -109,5 +109,9 @@ export declare class Backend {
|
|
|
109
109
|
ok: boolean;
|
|
110
110
|
content: any;
|
|
111
111
|
}>;
|
|
112
|
+
resizeImage(token: string, maxWidth: number, buf: ArrayBuffer): Promise<{
|
|
113
|
+
ok: boolean;
|
|
114
|
+
content: any;
|
|
115
|
+
}>;
|
|
112
116
|
private listParamToQuerystring;
|
|
113
117
|
}
|
package/dist/backend.js
CHANGED
|
@@ -179,7 +179,7 @@ class Backend {
|
|
|
179
179
|
return yield this.req(token, "PUT", `/inc/${repo}/${id}`, body);
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
storeFile(token,
|
|
182
|
+
storeFile(token, buf) {
|
|
183
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
184
184
|
let fd = new formData();
|
|
185
185
|
fd.append("file", buf, {
|
|
@@ -200,6 +200,18 @@ class Backend {
|
|
|
200
200
|
return yield this.req(rootToken, "POST", "/sudo/sendmail", data);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
+
resizeImage(token, maxWidth, buf) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
let fd = new formData();
|
|
206
|
+
fd.append("file", buf, {
|
|
207
|
+
contentType: "application/octect-stream",
|
|
208
|
+
filename: "file-upload"
|
|
209
|
+
});
|
|
210
|
+
fd.append("width", maxWidth);
|
|
211
|
+
const ct = `multipart/form-data; boundary=${fd.getBoundary()}`;
|
|
212
|
+
return yield this.rawreq(ct, token, "POST", "/extra/resizeimg", fd);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
203
215
|
listParamToQuerystring(param) {
|
|
204
216
|
var qs = "";
|
|
205
217
|
if (param) {
|