Skip to content

Commit 10b7cf5

Browse files
authored
refactor(utils): Remove unused download progress handling. (#176)
1 parent 60c476b commit 10b7cf5

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

src/services/LogFileManager/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const loadFile = async (fileSrc: FileSrcType)
139139
let fileData: Uint8Array;
140140
if ("string" === typeof fileSrc) {
141141
fileName = getBasenameFromUrlOrDefault(fileSrc);
142-
fileData = await getUint8ArrayFrom(fileSrc, () => null);
142+
fileData = await getUint8ArrayFrom(fileSrc);
143143
} else {
144144
fileName = fileSrc.name;
145145
fileData = new Uint8Array(await fileSrc.arrayBuffer());

src/utils/http.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import axios, {AxiosError} from "axios";
22

33

4-
type ProgressCallback = (numBytesDownloaded:number, numBytesTotal:number) => void;
5-
64
/**
75
* Converts an Axios error into a custom Error object.
86
*
@@ -36,21 +34,14 @@ const convertAxiosError = (e: AxiosError): Error => {
3634
* Downloads (bypassing any caching) a file as a Uint8Array.
3735
*
3836
* @param fileUrl
39-
* @param progressCallback
4037
* @return The file's content.
4138
* @throws {Error} if the download fails.
4239
*/
43-
const getUint8ArrayFrom = async (fileUrl: string, progressCallback: ProgressCallback)
40+
const getUint8ArrayFrom = async (fileUrl: string)
4441
: Promise<Uint8Array> => {
4542
try {
4643
const {data} = await axios.get<ArrayBuffer>(fileUrl, {
4744
responseType: "arraybuffer",
48-
onDownloadProgress: ({loaded, total}) => {
49-
if ("undefined" === typeof total) {
50-
total = loaded;
51-
}
52-
progressCallback(loaded, total);
53-
},
5445
headers: {
5546
"Cache-Control": "no-cache",
5647
"Pragma": "no-cache",

0 commit comments

Comments
 (0)