LoadModuleFile returns a js value with given file path and module name.
(filePath string, moduleName string)
| 1032 | |
| 1033 | // LoadModuleFile returns a js value with given file path and module name. |
| 1034 | func (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. |
| 1043 | func (ctx *Context) CompileModule(filePath string, moduleName string, opts ...EvalOption) ([]byte, error) { |