MCPcopy Create free account
hub / github.com/buke/quickjs-go / LoadModuleFile

Method LoadModuleFile

context.go:1034–1040  ·  view source on GitHub ↗

LoadModuleFile returns a js value with given file path and module name.

(filePath string, moduleName string)

Source from the content-addressed store, hash-verified

1032
1033// LoadModuleFile returns a js value with given file path and module name.
1034func (ctx *Context) LoadModuleFile(filePath string, moduleName string) *Value {
1035 b, err := os.ReadFile(filePath)
1036 if err != nil {
1037 return ctx.ThrowError(err)
1038 }
1039 return ctx.LoadModule(string(b), moduleName)
1040}
1041
1042// CompileModule returns a compiled bytecode with given code and module name.
1043func (ctx *Context) CompileModule(filePath string, moduleName string, opts ...EvalOption) ([]byte, error) {

Callers 1

TestContextModulesFunction · 0.95

Calls 2

ThrowErrorMethod · 0.95
LoadModuleMethod · 0.95

Tested by 1

TestContextModulesFunction · 0.76