How to get raw url of latest release so i can download through node js streams
import https from "https"
const { pipeline } = require("stream/promises")
import path from "path"
import fs from "fs"
async function download(url) {
return new Promise(async (onSuccess) => {
https.get(url, async (res) => {
let fileName = url.split("/").pop()
const fileWriteStream = fs.createWriteStream(path.join(__dirname, fileName), {
autoClose: true,
flags: "w",
})
await pipeline(res, fileWriteStream)
onSuccess("success")
})
})
}
// works fine
await download("https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1")
// doesnt work
await download("https://github.com/spicetify/spicetify-cli/releases/download/v2.15.0/spicetify-2.15.0-windows-x64.zip")
if this is not possible whats the way to download latest release throught node-js as i use electron