Module lsh.memfd
In-memory anonymous file.
Functions
new ([buf[, len]]) | Constructs new in-memory anonymous file and returns handle to it. |
__call (_M[, buf[, len]]) | Shorthand for new. |
Functions
- new ([buf[, len]])
-
Constructs new in-memory anonymous file and returns
handle to it.
Parameters:
- buf cdata or string initialize new instance with buffer (optional)
- len
int
lenght of the inital buffer (only needed if buf is
cdata
) (optional)
Returns:
-
lsh.fio.fh
new fio.fh instance
Or
- nil
- string error
Usage:
local sh = require 'lsh' local fh = memfd.new() fh:write('abc') fh:seek(0) print(fh)
- __call (_M[, buf[, len]])
-
Shorthand for new.
Parameters:
- _M table module table
- buf cdata or string initial buffer to fill new instance (optional)
- len
int
lenght of the inital buffer (only needed if buf is
cdata
) (optional)
Returns:
-
lsh.fio.fh
new fio.fh instance
Or
- nil
- string error
Usage:
local sh = require 'lsh' local fh = memfd('abc') fh:seek(0) print(fh)