-2

error screenshot along with code snippet I am trying to copy content from one file to another but the hyperterminal throws error. I have no idea. Could you help?

I have entered the syntax for copyFile but it is not working ?whether it is because of version or something else?

  • 2
    Please check out the [question asking guide](https://stackoverflow.com/help/how-to-ask) specifically, **DO NOT post images of code, data, error messages, etc.—copy or type the text into the question.** – Aurast Jan 18 '23 at 20:59
  • You need to pass the callback or you can use the promise version: [See documentation](https://nodejs.org/api/fs.html#fscopyfilesrc-dest-mode-callback) `fs.copyFile(src, dest, callback)` – Mostafa Fakhraei Jan 18 '23 at 21:02
  • The `callback` argument to `fs.copyFile()` is not optional. See the [documentation](https://nodejs.org/api/fs.html#fscopyfilesrc-dest-mode-callback) – Barmar Jan 18 '23 at 21:13

1 Answers1

0

You need to use fs.copyFileSync

qyy0712
  • 26
  • 1