Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jonas1ara/2f91a8baed5403b5e600463e80f03e76 to your computer and use it in GitHub Desktop.
Save jonas1ara/2f91a8baed5403b5e600463e80f03e76 to your computer and use it in GitHub Desktop.
download an image and display it in your console with fshttp and spectre.console packages in fsx F# script
#r "nuget: FsHttp"
#r "nuget: Spectre.Console.ImageSharp"
open FsHttp
open Spectre.Console
let imgUrl =
"https://banner2.cleanpng.com/20200525/frt/transparent-hero-image-hero-logo-cartoon-5ecc928ba8c9a0.2212187815904651636914.jpg"
let str = http { GET imgUrl } |> Request.send |> Response.toStream
let image =
let i = new CanvasImage(data = str)
i.MaxWidth <- 64
i
AnsiConsole.Write(image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment