mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
tesseract worker restart to aviod memory leak
This commit is contained in:
@@ -36,6 +36,7 @@ export default {
|
||||
statFile: statFile,
|
||||
renameFile: renameFile,
|
||||
deleteDir: deleteDir,
|
||||
formatBytes: formatBytes,
|
||||
}
|
||||
|
||||
import fs from 'fs'
|
||||
@@ -296,3 +297,15 @@ function renameFile(oldPath: string, newPath: string): string {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function formatBytes(number: number, unit: 'MB' | 'GB' = 'MB'): string {
|
||||
let res = number / 1024 / 1024 // MB
|
||||
if (unit === 'MB') {
|
||||
return `${res} MB`
|
||||
}
|
||||
res = res / 1024
|
||||
if (unit === 'GB') {
|
||||
return `${res} GB`
|
||||
}
|
||||
return `${number} byte`
|
||||
}
|
||||
|
Reference in New Issue
Block a user