Buffer:encode(encoding) method
Returns a string, encoded from the Buffer according to the provided encoding.
Parameters
encoding
A string that specifies the encoding method to convert the binary Buffer to string :
- "utf8" : uses the UTF8 encoding (default)
- "unicode" : uses the UNICODE (UCS-2 LE) encoding
- "base64" : uses base64 encoding
- "hex" : uses hexadecimal encoding
Return value
Returns the encoded string.Example
-- base64 conversion
-- outputs "TMO7w6Q="
print(sys.Buffer("LuaRT"):encode("base64"))