EvalFile returns a js value with given code and filename. Need call Free() `quickjs.Value`'s returned by `Eval()` and `EvalFile()` and `EvalBytecode()`.
(filePath string, opts ...EvalOption)
| 983 | // EvalFile returns a js value with given code and filename. |
| 984 | // Need call Free() `quickjs.Value`'s returned by `Eval()` and `EvalFile()` and `EvalBytecode()`. |
| 985 | func (ctx *Context) EvalFile(filePath string, opts ...EvalOption) *Value { |
| 986 | b, err := os.ReadFile(filePath) |
| 987 | if err != nil { |
| 988 | return ctx.ThrowError(err) |
| 989 | } |
| 990 | opts = append(opts, EvalFileName(filePath)) |
| 991 | return ctx.Eval(string(b), opts...) |
| 992 | } |
| 993 | |
| 994 | // LoadModule returns a js value with given code and module name. |
| 995 | func (ctx *Context) LoadModule(code string, moduleName string, opts ...EvalOption) *Value { |