Module lsh.memfd

In-memory anonymous file.

Functions

new ([buf[, len]]) Constructs a new in-memory anonymous file and returns a handle to it.
__call (_M[, buf[, len]]) Shorthand for new.


Functions

new ([buf[, len]])
Constructs a new in-memory anonymous file and returns a handle to it.

Parameters:

  • buf cdata or string initial content of the new instance (optional)
  • len int length of the initial buffer (required if buf is cdata) (optional)

Returns:

    lsh.fio.fh new fio.fh instance

Or

  1. nil
  2. string error

Usage:

    local sh = require 'lsh'
    
    local fh = sh.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 content of the new instance (optional)
  • len int length of the initial buffer (required if buf is cdata) (optional)

Returns:

    lsh.fio.fh new fio.fh instance

Or

  1. nil
  2. string error

Usage:

    local sh = require 'lsh'
    
    local fh = sh.memfd('abc')
    fh:seek(0)
    print(fh)
generated by LDoc 1.5.0 Last updated 2026-09-27 08:00:58 UTC (28dfb93)