How can you use the fs module to copy a file from one location to another?

  • fs.copyFile()
  • fs.moveFile()
  • fs.rename()
  • fs.copy()
To copy a file from one location to another using the fs module, you can use the fs.copyFile() method. This method allows you to copy the contents of one file to another location. The other options (fs.moveFile(), fs.rename(), and fs.copy()) serve different purposes in file manipulation but are not specifically for copying a file to another location.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *