summaryrefslogtreecommitdiff
path: root/runtime/js/40_files.js
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-04-12 20:32:58 +0800
committerGitHub <noreply@github.com>2021-04-12 14:32:58 +0200
commit9d53dab4df64361f00dda2534eecbd04797d56a2 (patch)
treea80694575404f5203b058222b6ce5a6702c05011 /runtime/js/40_files.js
parentda9219341fe8bcf080d3ebdd03d35cec1268875e (diff)
feat(runtime): add truncate and truncateSync methods to Deno.File (#10130)
Diffstat (limited to 'runtime/js/40_files.js')
-rw-r--r--runtime/js/40_files.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/js/40_files.js b/runtime/js/40_files.js
index 2ce495f8e..d552b4ba5 100644
--- a/runtime/js/40_files.js
+++ b/runtime/js/40_files.js
@@ -4,7 +4,7 @@
((window) => {
const core = window.Deno.core;
const { read, readSync, write, writeSync } = window.__bootstrap.io;
- const { fstat, fstatSync } = window.__bootstrap.fs;
+ const { ftruncate, ftruncateSync, fstat, fstatSync } = window.__bootstrap.fs;
const { pathFromURL } = window.__bootstrap.util;
function seekSync(
@@ -88,6 +88,14 @@
return writeSync(this.rid, p);
}
+ truncate(len) {
+ return ftruncate(this.rid, len);
+ }
+
+ truncateSync(len) {
+ return ftruncateSync(this.rid, len);
+ }
+
read(p) {
return read(this.rid, p);
}