简体   繁体   English

Node.JS WriteFile - 特定大小的文件

[英]Node.JS WriteFile - File of specific size

Is there a way to specify the size/length of a file and have the system reserve the space needed? 有没有办法指定文件的大小/长度,并让系统保留所需的空间? I'm looking for something like: 我正在寻找类似的东西:

fs.write('file', Buffer, 1024*1024*54); // To create 54MB file.

只需创建一个这么大的缓冲区

fs.writeFile('file', new Buffer(1024*1024*54));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM