Skip to main content

Scala Toolkit makes Scala powerful straight out of the box

Szymon Rodziewicz

Scala Compiler Developer
Nov 7, 2022|10 min read
Scala_Toolkit_makes_Scala_powerful_straight_out_of_the_box_cover

Tutorials for Scala Toolkit

Show me the toolkit
1brew install scala-cli
1//> using toolkit "latest"
2import sttp.client4.quick.*
3import sttp.client4.Response
4
5// fetch my external ip from a remote API returning a JSON string
6val response: Response[String] = quickRequest.get(uri"http://httpbin.org/ip").send()
7val fileName = "my-ip.txt" // write our ip down to "my-ip.txt" file
8val ip = ujson.read(response.body)("origin").str // read "origin" property of the json response
9os.write.over(os.pwd / fileName, ip) // overwrite output file if exists
1scala-cli script.sc

Subscribe to our newsletter and never miss an article