FS Module File Status

Medium
0.0% Acceptance

In this lab, you'll learn how to use Node.js's fs.fstat() method to retrieve information about a file. This method allows you to retrieve the file's metadata, such as the file size, mode, and modification time. Your task is to read the file sample.txt and print the file size in bytes using the fs.fstat() method.

Challenges:

  1. Import fs and use fs.promises.
  2. Open the sample.txt file using fs.open().
  3. Retrieve file descriptor using fs.fstat().
  4. Print the file size in bytes.