Skip to content

Commit

Permalink
Modified the loadfile example to showcase how Boa can directly read…
Browse files Browse the repository at this point in the history
… bytes
  • Loading branch information
Razican committed Oct 21, 2022
1 parent d51fee7 commit 4797cc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions boa_examples/src/bin/loadfile.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// This example shows how to load, parse and execute JS code from a source file
// (./scripts/helloworld.js)

use std::fs::read_to_string;
use std::fs;

use boa_engine::Context;

fn main() {
let js_file_path = "./scripts/helloworld.js";

match read_to_string(js_file_path) {
match fs::read(js_file_path) {
Ok(src) => {
// Instantiate the execution context
let mut context = Context::default();
Expand Down

0 comments on commit 4797cc9

Please sign in to comment.