From 4797cc9b3e168bfb50ab9a3c04df45e6c37f85d7 Mon Sep 17 00:00:00 2001 From: Iban Eguia Moraza Date: Fri, 21 Oct 2022 11:51:30 +0200 Subject: [PATCH] Modified the `loadfile` example to showcase how Boa can directly read bytes --- boa_examples/src/bin/loadfile.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boa_examples/src/bin/loadfile.rs b/boa_examples/src/bin/loadfile.rs index 595e863f7c2..b88fe490fc9 100644 --- a/boa_examples/src/bin/loadfile.rs +++ b/boa_examples/src/bin/loadfile.rs @@ -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();