|
@@ -56,38 +56,3 @@ async function* fileChunkReaderMaker(file: File, chunkSize: number) {
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
-
|
|
|
|
-// depreciated
|
|
|
|
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
-async function getUint8ArrayViewOld(
|
|
|
|
- reader: FileReader,
|
|
|
|
- file: Blob,
|
|
|
|
-): Promise<Uint8Array> {
|
|
|
|
- return await new Promise((resolve, reject) => {
|
|
|
|
- reader.onabort = () =>
|
|
|
|
- reject(
|
|
|
|
- Error(
|
|
|
|
- `file reading was aborted, file size= ${convertBytesToHumanReadable(
|
|
|
|
- file.size,
|
|
|
|
- )}`,
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
- reader.onerror = () =>
|
|
|
|
- reject(
|
|
|
|
- Error(
|
|
|
|
- `file reading has failed, file size= ${convertBytesToHumanReadable(
|
|
|
|
- file.size,
|
|
|
|
- )} , reason= ${reader.error}`,
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
- reader.onload = () => {
|
|
|
|
- // Do whatever you want with the file contents
|
|
|
|
- const result =
|
|
|
|
- typeof reader.result === "string"
|
|
|
|
- ? new TextEncoder().encode(reader.result)
|
|
|
|
- : new Uint8Array(reader.result);
|
|
|
|
- resolve(result);
|
|
|
|
- };
|
|
|
|
- reader.readAsArrayBuffer(file);
|
|
|
|
- });
|
|
|
|
-}
|
|
|