Download precompiled packages to a local directory


I want to write a Go client which can fetch precompiled packages from the binary cache given a package name and a version (eg. go 1.18). Is it possible to find the location of the binary on and download it? I’m only interested in the pre-compiled binaries which I can download in a local directory, not building them with nix.