Fixed shell install

This commit is contained in:
Mike Nolan 2024-12-30 07:20:30 -06:00
parent ab68fd82c9
commit f2a1c61feb
1 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,24 @@
func downloadPackage(name,version,path)
{
var uri = $"https://cpkg.tesseslanguage.com/api/v1/download?name={Net.Http.UrlEncode(name)}&version={Net.Http.UrlEncode(version)}";
var req = Net.Http.MakeRequest(uri);
if(req.StatusCode == 200)
{
var strm = FS.MemoryStream(true);
req.CopyToStream(strm);
var f = FS.Local.OpenFile(path,"wb");
strm.Seek(0,0);
strm.CopyTo(f);
f.Close();
strm.Close();
req.Close();
}
else
{
throw $"Error when downloading package {name} with version {version}";
}
}