Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix type errors in fs.ts

Manav Rathi0fdb2fb3575d
diff --git a/desktop/src/services/fs.ts b/desktop/src/services/fs.ts
index c74790d01f..356b49c186 100644
--- a/desktop/src/services/fs.ts
+++ b/desktop/src/services/fs.ts
@@ -25,16 +25,14 @@ export const getDirFilePaths = async (dirPath: string) => {
return files;
};
-export const getFileStream = async (filePath: string) => {
+const getFileStream = async (filePath: string) => {
const file = await fs.open(filePath, "r");
let offset = 0;
const readableStream = new ReadableStream<Uint8Array>({
async pull(controller) {
try {
const buff = new Uint8Array(FILE_STREAM_CHUNK_SIZE);
- // original types were not working correctly
- const bytesRead = (await fs.read(
- file,
+ const bytesRead = (await file.read(
buff,
0,
FILE_STREAM_CHUNK_SIZE,
@@ -43,16 +41,16 @@ export const getFileStream = async (filePath: string) => {
offset += bytesRead;
if (bytesRead === 0) {
controller.close();
- await fs.close(file);
+ await file.close();
} else {
controller.enqueue(buff.slice(0, bytesRead));
}
} catch (e) {
- await fs.close(file);
+ await file.close();
}
},
async cancel() {
- await fs.close(file);
+ await file.close();
},
});
return readableStream;