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:
- Bitburner – How to Print with Using Color
- Bitburner – How to Auto Hack Script (Auto-Farm)
- Bitburner – How to Do Autocomplete Scripts (VS Code)
- Bitburner – How to Get Any Achievement Guide