Perform following steps,
- import path from 'path';
- Need for path of files in order to access them
- import fs from 'fs';
- Need for read and write on files
- In order to read or write, first we need to resolve the directory of the file
- path.resolve(__dirname, 'directoryPath')
- For reading
- fs.readFileSync()
- For writing
- fs.writeFileSync()
No comments:
Post a Comment