tristanisham / zvm

zvm (Zig Version Manager) lets you easily install/upgrade between different versions of Zig.

Home Page:https://www.zvm.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Determine a method of download files using native Zig

tristanisham opened this issue · comments

Currently, ZVM uses a cURL binding which makes it platform exclusive. I'd like to find a native Zig solution so ZVM can be compiled with minimal effort on the end user's part.

This is referring to https://github.com/tristanisham/zvm/blob/909f4f3db936019184ac869e354dcdd1d9ee0e6a/install.sh, correct? In other words, you'd want a cross-platform tool which:

1 - Figures out the host's target

zvm/install.sh

Lines 7 to 8 in 909f4f3

ARCH=$(uname -m)
OS=$(uname -s)

2 - Downloads the GitHub release for the host's target (https://github.com/tristanisham/zvm/releases/latest/download/$PLATFORM)

zvm/install.sh

Line 26 in 909f4f3

wget -q --show-progress --max-redirect 5 -O zvm.tar "https://github.com/tristanisham/zvm/releases/latest/download/$1"

3 - Extracts it afterwards

zvm/install.sh

Line 27 in 909f4f3

tar -xf zvm.tar

Is that it? Apologies if I have misunderstood the intent here.

Zig now has a native http module in the standard library.