Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/LogFileManager/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const loadFile = async (fileSrc: FileSrcType)
let fileData: Uint8Array;
if ("string" === typeof fileSrc) {
fileName = getBasenameFromUrlOrDefault(fileSrc);
fileData = await getUint8ArrayFrom(fileSrc, () => null);
fileData = await getUint8ArrayFrom(fileSrc);
} else {
fileName = fileSrc.name;
fileData = new Uint8Array(await fileSrc.arrayBuffer());
Expand Down
11 changes: 1 addition & 10 deletions src/utils/http.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import axios, {AxiosError} from "axios";


type ProgressCallback = (numBytesDownloaded:number, numBytesTotal:number) => void;

/**
* Converts an Axios error into a custom Error object.
*
Expand Down Expand Up @@ -36,21 +34,14 @@ const convertAxiosError = (e: AxiosError): Error => {
* Downloads (bypassing any caching) a file as a Uint8Array.
*
* @param fileUrl
* @param progressCallback
* @return The file's content.
* @throws {Error} if the download fails.
*/
const getUint8ArrayFrom = async (fileUrl: string, progressCallback: ProgressCallback)
const getUint8ArrayFrom = async (fileUrl: string)
: Promise<Uint8Array> => {
try {
const {data} = await axios.get<ArrayBuffer>(fileUrl, {
responseType: "arraybuffer",
onDownloadProgress: ({loaded, total}) => {
if ("undefined" === typeof total) {
total = loaded;
}
progressCallback(loaded, total);
},
headers: {
"Cache-Control": "no-cache",
"Pragma": "no-cache",
Expand Down