Question: ******JAVASCRIPT****** Four synchronous tasks [20%] Allowed Node.js API Functions: fs.readFile(), zlib.inflate(), dns.resolve(), fs.writeFile() Input: domain.deflated Output: File: ip_address.txt Write a program that: Reads domain.deflated (Use

******JAVASCRIPT******

Four synchronous tasks [20%]

  • Allowed Node.js API Functions: fs.readFile(), zlib.inflate(), dns.resolve(), fs.writeFile()
  • Input: domain.deflated
  • Output: File: ip_address.txt

Write a program that:

  1. Reads domain.deflated (Use {encoding:null} ),
  2. Decompresses the contents using zlib.inflate(), covert the resulting buffer to a string using .toString("utf8") the decompressed data will be a valid domain that resolves to a single IP address.
  3. Using dns.resolve() convert the domain into an IP address.
  4. Remove the array wrapper and write the IP address to a file ip_address.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!