Merge branch 'main' into bundle-webapp

This commit is contained in:
Abhinav 2022-07-23 16:23:27 +05:30
commit 95b79ddf64
2 changed files with 21 additions and 15 deletions

View file

@ -28,6 +28,7 @@ const getFileStream = async (filePath: string) => {
let offset = 0; let offset = 0;
const readableStream = new ReadableStream<Uint8Array>({ const readableStream = new ReadableStream<Uint8Array>({
async pull(controller) { async pull(controller) {
try {
const buff = new Uint8Array(FILE_STREAM_CHUNK_SIZE); const buff = new Uint8Array(FILE_STREAM_CHUNK_SIZE);
// original types were not working correctly // original types were not working correctly
@ -41,9 +42,14 @@ const getFileStream = async (filePath: string) => {
offset += bytesRead; offset += bytesRead;
if (bytesRead === 0) { if (bytesRead === 0) {
controller.close(); controller.close();
await fs.close(file);
} else { } else {
controller.enqueue(buff); controller.enqueue(buff);
} }
} catch (e) {
logError(e, 'stream pull failed');
await fs.close(file);
}
}, },
}); });
return readableStream; return readableStream;

View file

@ -1,7 +1,7 @@
{ {
"name": "ente", "name": "ente",
"productName": "ente", "productName": "ente",
"version": "2.0.0-alpha.9", "version": "1.6.0",
"private": true, "private": true,
"description": "Desktop client for ente.io", "description": "Desktop client for ente.io",
"main": "app/index.js", "main": "app/index.js",