webassembly

package
v1.21.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 23 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(config Config) (pdfium.Pool, error)

Init will return a multithreaded webassembly pool. It will launch a new worker for every requested instance as long as the limits allow it. If the pool has been exhausted. It will wait until a worker becomes available. So it's important that you close instances when you're done with them.

func InitWithWASM added in v1.19.6

func InitWithWASM(config Config) (pdfium.Pool, error)

InitWithWASM will return a multithreaded webassembly pool using the module in Config.WASM. Unlike Init, it does not reference the embedded default module, allowing applications that provide their own module to omit it at link time. This causes Go not to embed the default WASM file, saving about ~5MB in the resulting binary file.

Types

type Config

type Config struct {
	// Context is used to initialize the wazero runtime and as the parent
	// context for its workers. It must remain valid for the lifetime of the
	// pool. If nil, context.Background is used.
	Context       goctx.Context
	MinIdle       int
	MaxIdle       int
	MaxTotal      int
	WASM          []byte
	FSConfig      wazero.FSConfig
	RuntimeConfig wazero.RuntimeConfig
	Stdout        io.Writer
	Stderr        io.Writer
	RandomSource  io.Reader
	ReuseWorkers  bool // WebAssembly runtime by default doesn't use workers because creating new instances is cheap.
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL