π Quick Start Guide for encoding and decoding Base64 with LuaDoTheWorld
- β How to encode a file to Base64
- β How to decode Base64 back to a file
- β How to encode/decode strings and binaries
- LuaDoTheWorld installed and required in your script
local dtw = require("luaDoTheWorld/luaDoTheWorld")
local b64 = dtw.base64_encode_file("tests/target/blob.png")
print(b64)local dtw = require("luaDoTheWorld/luaDoTheWorld")
local b64 = dtw.base64_encode_file("tests/target/blob.png")
local image = dtw.base64_decode(b64)
dtw.write_file("tests/target/blob2.png", image)local dtw = require("luaDoTheWorld/luaDoTheWorld")
local image = dtw.load_file("tests/target/blob.png")
local b64 = dtw.base64_encode(image)
print(b64)| Function | What it does | Example |
|---|---|---|
dtw.base64_encode_file(path) |
Encode file to Base64 | dtw.base64_encode_file("file.png") |
dtw.base64_encode(data) |
Encode string/binary | dtw.base64_encode(image) |
dtw.base64_decode(b64) |
Decode Base64 to binary | dtw.base64_decode(b64) |
dtw.write_file(path, data) |
Write binary to file | dtw.write_file("out.png", data) |
- π Check the main SDK documentation
- π Look at other example scripts in the SDK
- π Report issues on our GitHub repository