Node.JS WriteFile - a file of a specific size

Is there a way to specify the file size / length and whether the system should reserve the space it needs? I am looking for something like:

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

      

+3


source to share


1 answer


Just create a Buffer of this size?



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

      

+3


source







All Articles