nodejs get file size

JavaScript
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

Also in JavaScript: