summaryrefslogtreecommitdiff
path: root/runtime/js/40_read_file.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/40_read_file.js')
-rw-r--r--runtime/js/40_read_file.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/js/40_read_file.js b/runtime/js/40_read_file.js
index 1efd5338d..7eee28d89 100644
--- a/runtime/js/40_read_file.js
+++ b/runtime/js/40_read_file.js
@@ -2,6 +2,7 @@
"use strict";
((window) => {
+ const core = window.Deno.core;
const { open, openSync } = window.__bootstrap.files;
const { readAll, readAllSync } = window.__bootstrap.io;
@@ -29,8 +30,7 @@
const file = openSync(path);
try {
const contents = readAllSync(file);
- const decoder = new TextDecoder();
- return decoder.decode(contents);
+ return core.decode(contents);
} finally {
file.close();
}
@@ -40,8 +40,7 @@
const file = await open(path);
try {
const contents = await readAll(file);
- const decoder = new TextDecoder();
- return decoder.decode(contents);
+ return core.decode(contents);
} finally {
file.close();
}