require overhaul part 2

This commit is contained in:
kepler155c@gmail.com
2018-12-23 17:32:38 -05:00
parent 29af471374
commit 83a9aa46ab
23 changed files with 99 additions and 101 deletions

View File

@@ -1,5 +1,3 @@
_G.requireInjector()
local Base64 = require('base64')
local http = _G.http
@@ -9,13 +7,13 @@ local shell = _ENV.shell
local args = { ... }
if not args[2] then
error('Syntax: base64dl <file name> <url>')
error('Syntax: base64dl <file name> <url>')
end
local c = http.get(args[2])
if not c then
error('unable to open url')
error('unable to open url')
end
local data = c.readAll()
@@ -27,13 +25,13 @@ print('decoded: ' .. #decoded)
local file = io.open(shell.resolve(args[1]), "wb")
if not file then
error('Unable to open ' .. args[1], 2)
error('Unable to open ' .. args[1], 2)
end
for k,b in ipairs(decoded) do
if (k % 1000) == 0 then
os.sleep(0)
end
file:write(b)
if (k % 1000) == 0 then
os.sleep(0)
end
file:write(b)
end
file:close()