Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to get file size in node js

var fs = require("fs"); //Load the filesystem module
var stats = fs.statSync("myfile.txt")
var fileSizeInBytes = stats.size;
// Convert the file size to megabytes (optional)
var fileSizeInMegabytes = fileSizeInBytes / (1024*1024);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #file #size #node #js
ADD COMMENT
Topic
Name
2+6 =