Skip to content

Commit

Permalink
Add script that reads/ prins file content - task 0
Browse files Browse the repository at this point in the history
  • Loading branch information
wendymunyasi committed Oct 18, 2022
1 parent 5615212 commit 460c703
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 0x14-javascript-web_scraping/0-readme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/node
const process = require('process');
const fs = require('fs');

// The first argument is the file path
const file = process.argv[2];

fs.readFile(file, 'utf8', function (err, data) {
// If an error occurred during the reading, print the error object
if (err) {
console.log(err);
} else {
process.stdout.write(data);
}
});

0 comments on commit 460c703

Please sign in to comment.