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:
- Reads domain.deflated (Use {encoding:null} ),
- 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.
- Using dns.resolve() convert the domain into an IP address.
- 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
