Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个变量“img”,它是一个已通过以下方式加载的图像文件:
var img = fs.readFileSync('./tmp.png');
如何确定“img”变量的字节数?
就像img是一个缓冲区,你可以简单地使用img.length,它会给你八位字节的大小(8位字节)
img
img.length