I have a variable 'img' which is an image file that has been loaded via:
var img = fs.readFileSync('./tmp.png');
How do I determine how many bytes the 'img' variable is?
Like img
is a buffer, you can simply use img.length
, it will give you the size in octets (byte of 8bits)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With