0% found this document useful (0 votes)
1 views1 page

NodeJS File Assignment

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views1 page

NodeJS File Assignment

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name: OLATOYE ISRAEL AYOMIDE

Matric number: AU24AC6527

[Link] File Assignment


This script reads text from one file, appends some text, and writes the result into a new file

const fs = require("fs");

// Read from the first file


[Link]("[Link]", "utf8", (err, data) => {
if (err) {
[Link]("Error reading file:", err);
return;
}

// Append extra text


const newData = data + "\nThis text was added by the script.";

// Write to a new file


[Link]("[Link]", newData, (err) => {
if (err) {
[Link]("Error writing file:", err);
return;
}

[Link]("New file created successfully!");


});
});

You might also like