Enhance core API

- Add trim function to core API
- Minor bug fix
This commit is contained in:
lxsang
2020-06-06 18:41:43 +02:00
parent 598c11b2c3
commit edbffeb2b8
4 changed files with 42 additions and 41 deletions

View File

@ -169,7 +169,7 @@ namespace OS {
// copy file
return file
.read("binary")
.then(async (data: BlobPart) => {
.then(async (data: ArrayBuffer) => {
const d = await tof
.setCache(
new Blob([data], {
@ -246,15 +246,19 @@ namespace OS {
} else {
return file
.read("binary")
.then((d: any) => {
.then(async (d: any) => {
const zpath = `${base}${file.basename}`.replace(
/^\/+|\/+$/g,
""
);
zip.file(zpath, d, { binary: true });
return this.aradd(list, zip, base)
.then(() => resolve(zip))
.catch((e) => reject(__e(e)));
try {
await this.aradd(list, zip, base);
return resolve(zip);
}
catch (e) {
return reject(__e(e));
}
})
.catch((e: Error) => reject(__e(e)));
}