diff --git a/src/services/electron/imageProcessor.ts b/src/services/electron/imageProcessor.ts index cf75817c5..9f8a84aa3 100644 --- a/src/services/electron/imageProcessor.ts +++ b/src/services/electron/imageProcessor.ts @@ -1,6 +1,6 @@ import { ElectronAPIs } from 'types/electron'; import { ElectronFile } from 'types/upload'; -import { makeHumanReadableStorage } from 'utils/billing'; +import { convertBytesToHumanReadable } from 'utils/file/size'; import { addLogLine } from 'utils/logging'; import { logError } from 'utils/sentry'; @@ -29,9 +29,9 @@ class ElectronImageProcessorService { inputFileData ); addLogLine( - `originalFileSize:${makeHumanReadableStorage( + `originalFileSize:${convertBytesToHumanReadable( fileBlob?.size - )},convertedFileSize:${makeHumanReadableStorage( + )},convertedFileSize:${convertBytesToHumanReadable( convertedFileData?.length )}, native heic conversion time: ${Date.now() - startTime}ms ` ); @@ -58,9 +58,9 @@ class ElectronImageProcessorService { maxSize ); addLogLine( - `originalFileSize:${makeHumanReadableStorage( + `originalFileSize:${convertBytesToHumanReadable( inputFile?.size - )},thumbFileSize:${makeHumanReadableStorage( + )},thumbFileSize:${convertBytesToHumanReadable( thumb?.length )}, native thumbnail generation time: ${ Date.now() - startTime diff --git a/src/services/wasmHeicConverter/wasmHEICConverterService.ts b/src/services/wasmHeicConverter/wasmHEICConverterService.ts index 3636eb62f..ce34cfd3d 100644 --- a/src/services/wasmHeicConverter/wasmHEICConverterService.ts +++ b/src/services/wasmHeicConverter/wasmHEICConverterService.ts @@ -3,10 +3,10 @@ import { CustomError } from 'utils/error'; import { retryAsyncFunction } from 'utils/network'; import { logError } from 'utils/sentry'; import { addLogLine } from 'utils/logging'; -import { makeHumanReadableStorage } from 'utils/billing'; import { DedicatedConvertWorker } from 'worker/convert.worker'; import { ComlinkWorker } from 'utils/comlink/comlinkWorker'; import { getDedicatedConvertWorker } from 'utils/comlink'; +import { convertBytesToHumanReadable } from 'utils/file/size'; const WORKER_POOL_SIZE = 2; const MAX_CONVERSION_IN_PARALLEL = 1; @@ -52,9 +52,9 @@ class HEICConverter { CONVERT_FORMAT ); addLogLine( - `originalFileSize:${makeHumanReadableStorage( + `originalFileSize:${convertBytesToHumanReadable( fileBlob?.size - )},convertedFileSize:${makeHumanReadableStorage( + )},convertedFileSize:${convertBytesToHumanReadable( convertedHEIC?.size )}, heic conversion time: ${ Date.now() - startTime @@ -74,10 +74,10 @@ class HEICConverter { Error(`converted heic fileSize is Zero`), 'converted heic fileSize is Zero', { - originalFileSize: makeHumanReadableStorage( + originalFileSize: convertBytesToHumanReadable( fileBlob?.size ?? 0 ), - convertedFileSize: makeHumanReadableStorage( + convertedFileSize: convertBytesToHumanReadable( convertedHEIC?.size ?? 0 ), } diff --git a/src/utils/file/index.ts b/src/utils/file/index.ts index 5a08ca0ac..7f57987a3 100644 --- a/src/utils/file/index.ts +++ b/src/utils/file/index.ts @@ -29,8 +29,8 @@ import { import { IsArchived, updateMagicMetadataProps } from 'utils/magicMetadata'; import { addLogLine } from 'utils/logging'; -import { makeHumanReadableStorage } from 'utils/billing'; import { CustomError } from 'utils/error'; +import { convertBytesToHumanReadable } from './size'; const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000; @@ -352,7 +352,7 @@ async function getPlayableVideo(videoNameTitle: string, video: Uint8Array) { async function getRenderableImage(fileName: string, imageBlob: Blob) { if (await isFileHEIC(imageBlob, fileName)) { addLogLine( - `HEICConverter called for ${fileName}-${makeHumanReadableStorage( + `HEICConverter called for ${fileName}-${convertBytesToHumanReadable( imageBlob.size )}` );