~mna/tulip

The tulip.xio module contains IO functions that extend Lua's standard io module.

#API

Assuming local xio = require 'tulip.xio'.

#s = xio.b64decode(s)

Decodes s which is a base64-encoded string using URL-safe characters. Returns nil if it was not properly encoded.

#s = xio.b64encode(s)

Encodes s into a base64 string, using URL-safe characters.

#tok = xio.random(len)

Generates a random token of the specified length.

#n = xio.randomint([n])

Generates a uniform random integer between [0, n-1]. If n is omitted, the interval is [0,2^64−1].

#s, err = xio.read_file(path)

Reads the full content of path and returns the string. On error, returns nil and the error message.

Back to index

About this wiki

commit 3ebfbd288b8e5c95fdf8ce2027a0e94cfa1c8976
Author: Martin Angers <martin.n.angers@gmail.com>
Date:   2021-02-25T14:07:12-05:00

Update to reflect Request:validate_body
Clone this wiki
https://git.sr.ht/~mna/tulip-wiki (read-only)
git@git.sr.ht:~mna/tulip-wiki (read/write)