最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Node.JS WriteFile - File of specific size - Stack Overflow

programmeradmin2浏览0评论

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.

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.
Share Improve this question asked Jun 20, 2015 at 9:35 MatBeeMatBee 2846 silver badges17 bronze badges 1
  • See this example for a decent implementation. – Patrick Roberts Commented Jun 20, 2015 at 9:46
Add a ment  | 

1 Answer 1

Reset to default 7

Just create a Buffer of that size?

fs.writeFile('file', new Buffer(1024*1024*54));
发布评论

评论列表(0)

  1. 暂无评论