mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 02:22:40 +00:00
feat(runtime): add truncate and truncateSync methods to Deno.File (#10130)
This commit is contained in:
parent
da9219341f
commit
9d53dab4df
3 changed files with 55 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue