Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

nodejs get file size

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 / 1000000.0
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #nodejs #file #size
ADD COMMENT
Topic
Name
6+4 =