Add asset downloaing via download_models.luau

This commit is contained in:
2025-09-22 17:27:15 -04:00
parent 749c070609
commit 50d71a004d
2 changed files with 52 additions and 6 deletions
+24
View File
@@ -0,0 +1,24 @@
local fs = require("@lune/fs")
local net = require("@lune/net")
local process = require("@lune/process")
-- should be an open cloud api key with assetdelivery scope
local OPEN_CLOUD_API_KEY = process.env.OPEN_CLOUD_API_KEY
local BASE_API_URL = "https://apis.roblox.com/asset-delivery-api/v1/assetId/"
local download_models = {}
function download_models.downloadModel(assetId: number, fileName: string?): string?
local response = net.request({
url = BASE_API_URL .. assetId,
method = "GET",
headers = {["x-api-key"] = OPEN_CLOUD_API_KEY}
})
if response.ok then
return response.body
else
return nil
end
end
return download_models