Nim Programming Cookbook // Web programming

Fetch Web pages

Problem

Fetch a web page using nim and save it to a file.

Solution

import httpclient

let client = newHttpClient()
writeFile("index.html", client.getContent("http://nim-cookbook.btbytes.com"))

# Note: the above would not handle any HTTP or IO errors