0

I'm learning node.js and currently on how to copy file system,

import * as fs from 'fs';
import * as fs from 'fs/promises';
fs.copyFileSync("file1.txt", "file2.txt");

Using the above in VS code, I get prompts like: remove import from fs for first and second line, the fs in the third line is red, please help

Eniola
  • 3
  • 1

1 Answers1

0

You are importing two module as one variable

You can try import fs from "fs" and remove the second line, and your code fs.copyFileSync() is correct

tuphamdev96
  • 344
  • 1
  • 4