Lua exports reference
screenshot, upload, presign and the log exports.
All exports are server-side.
screenshot(source, options, cb): captures a player's screen and uploads it from the player's machine through a presigned URL. Options: folder, encoding (default jpg), quality (default 0.85). Times out after 30 seconds.
exports.basix:screenshot(source, { folder = 'reports' }, function(err, file)
if err then return print('[basix] ' .. err) end
print(file.url, file.id, file.path)
end)upload(options, cb): uploads bytes the server already has. Options: data (base64 string or data URI, required), name, folder, keep (true = exempt from folder retention).
exports.basix:upload({ data = base64Data, name = 'clip.webm', folder = 'clips' }, function(err, file)
if err then return print(err) end
print(file.url, file.size)
end)presign(options, cb): returns a one-time upload URL for a client. Options: type (image, video, audio; default image), folder.
exports.basix:presign({ type = 'video', folder = 'clips' }, function(err, url)
if err then return print(err) end
TriggerClientEvent('myresource:recordAndUpload', source, url)
end)log(level, message, options) and the shortcuts info, warn, error, debug (message, options). Options: player, resource (defaults to the calling resource), metadata. Events are buffered and sent every 2 seconds in one request. Up to 400 events are kept in memory if the API cannot be reached.
exports.basix:log('info', 'Player bought a car', {
player = GetPlayerIdentifierByType(source, 'license'),
metadata = { model = 'sultan', price = 25000 },
})
exports.basix:error('Payment failed', { metadata = { reason = 'insufficient funds' } })cb is always function(err, result). err is nil on success, otherwise a readable message.
Try it on your own server
Create a free account and your API key is ready in about two minutes. 3 GB included, bandwidth never billed, no card needed.