I have a file that is roughly 51Mb (as seen in Finder). "GetInfo" shows Size: 51,534,849 bytes (52.3 MB on disk)
When I upload this file to the server the byteLength
of the uploaded Buffer
is a lot smaller. Does it depend on the file type or any other properties? How do I get the correct uploaded file size
import { UploadedFile } from "express-fileupload";
private getFileSize(fileUpload: UploadedFile) {
const fileData = fileUpload.data;
console.log(fileData.byteLength, fileData.length, Buffer.byteLength(fileData))
return fileData.???;
}
In the above fileData.byteLength
, fileData.length
, Buffer.byteLength(fileData)
all give the same result of 18118252
, which divided by 1024
is roughly 17Mb
I am using Postman, if it matters