0% found this document useful (0 votes)
30 views5 pages

Task 1 Blocking: Require Readfilesync Log Tostring

The document outlines various tasks related to file operations in Node.js, demonstrating both blocking and non-blocking methods for reading files. It also includes examples of writing to a file, renaming a file, and deleting a file using the fs module. The conclusion emphasizes the understanding of Node's non-blocking and asynchronous nature through these file system operations.

Uploaded by

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

Task 1 Blocking: Require Readfilesync Log Tostring

The document outlines various tasks related to file operations in Node.js, demonstrating both blocking and non-blocking methods for reading files. It also includes examples of writing to a file, renaming a file, and deleting a file using the fs module. The conclusion emphasizes the understanding of Node's non-blocking and asynchronous nature through these file system operations.

Uploaded by

Anil Navale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Task 1

BLocking

var fs = require("fs");

var data = [Link]('[Link]');


   
   [Link]([Link]());

[Link]("Program Ended");

Output

Task 2
Non - Blocking

var fs = require("fs");

[Link]('[Link]', function (err, data) {


   if (err) return [Link](err);
   [Link]([Link]());
});

[Link]("Program Ended");

Output

Task 3
Write into File

var fs = require('fs');

[Link]('[Link]', 'May the Node be wit you', function (err) {


  if (err) throw err;
  [Link]('Saved!');
});
Output

Task 4

Rename File

var fs = require('fs');

[Link]('[Link]', '[Link]', function (err) {


  if (err) throw err;
  [Link]('File Renamed!');
});

Output
Task 5
Rename File

var fs = require('fs');

[Link]('[Link]', '[Link]', function (err) {


  if (err) throw err;
  [Link]('File Renamed!');
});

Output
Task 6

var fs = require('fs');

[Link]('[Link]', function (err) {


  if (err) throw err;
  [Link]('File deleted!');
});

Output
Conclusion -
Learned about the non-blocking and asynchronous nature of Node and also performed operations
using the file system(fs ) module.

You might also like