diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-04-12 20:32:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 14:32:58 +0200 |
commit | 9d53dab4df64361f00dda2534eecbd04797d56a2 (patch) | |
tree | a80694575404f5203b058222b6ce5a6702c05011 /runtime/js | |
parent | da9219341fe8bcf080d3ebdd03d35cec1268875e (diff) |
feat(runtime): add truncate and truncateSync methods to Deno.File (#10130)
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/40_files.js | 10 |
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); } |