Bitburner – Making Cat Viewer Program Guide

A guide on how to make cat viewer program in Bitburner.

Making Cat Viewer Program Guide

Making the .ns File

  • Open the editor with
nano GetCat.ns
  • Then paste the following code:
export async function main(ns) {
await ns.wget("https://api.thecatapi.com/v1/images/search", "json.txt");
var content = await ns.read("json.txt");
var url = JSON.parse(content)[0]["url"];
await ns.write(ns.args[0], <html><body><img src=\"${url}\"></img></body></html>, "w");
};
  • Make sure to save with Ctrl+B!

Using the File

  • To get your cat images, simply run
run GetCat.ns img.txt; cat img.txt
  • Alternatively, you can use a different file name to store the cat image.

Similar Posts:


Share your love

Leave a Reply