polywrap_wasm.inmemory_file_reader module

This module contains the InMemoryFileReader type for reading files from memory.

class polywrap_wasm.inmemory_file_reader.InMemoryFileReader(base_file_reader: FileReader, wasm_module: bytes | None = None, wasm_manifest: bytes | None = None)[source]

Bases: FileReader

InMemoryFileReader is an implementation of the FileReader protocol that reads files from memory.

Parameters:
  • base_file_reader (FileReader) – The base file reader used to read any files.

  • wasm_module (Optional[bytes]) – The Wasm module file of the wrapper.

  • wasm_manifest (Optional[bytes]) – The manifest of the wrapper.

read_file(file_path: str) bytes[source]

Read a file from memory.

Parameters:

file_path – The path of the file to read.

Returns:

The file contents or an error.