Answers for "how to get the file size in node.js"

1

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
Posted by: Guest on August-06-2020

Code answers related to "how to get the file size in node.js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language