summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tools/test/fmt.rs2
-rw-r--r--cli/tsc/dts/lib.deno.ns.d.ts91
-rw-r--r--ext/fs/30_fs.js16
-rw-r--r--ext/fs/lib.rs2
-rw-r--r--ext/fs/ops.rs2
-rw-r--r--runtime/js/90_deno_ns.js16
-rw-r--r--runtime/js/99_main.js4
-rw-r--r--tests/specs/future/runtime_api/main.js2
-rw-r--r--tests/specs/future/runtime_api/main.out2
9 files changed, 6 insertions, 131 deletions
diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs
index bfaac0616..5201bead6 100644
--- a/cli/tools/test/fmt.rs
+++ b/cli/tools/test/fmt.rs
@@ -322,7 +322,7 @@ pub const OP_DETAILS: phf::Map<&'static str, [&'static str; 2]> = phf_map! {
"op_fs_file_stat_async" => ["get file metadata", "awaiting the result of a `Deno.FsFile.prototype.stat` call"],
"op_fs_flock_async" => ["lock a file", "awaiting the result of a `Deno.FsFile.lock` call"],
"op_fs_fsync_async" => ["flush pending data operations for a file to disk", "awaiting the result of a `Deno.fsync` or `Deno.FsFile.sync` call"],
- "op_fs_ftruncate_async" => ["truncate a file", "awaiting the result of a `Deno.ftruncate` or `Deno.FsFile.truncate` call"],
+ "op_fs_file_truncate_async" => ["truncate a file", "awaiting the result of a `Deno.FsFile.prototype.truncate` call"],
"op_fs_funlock_async_unstable" => ["unlock a file", "awaiting the result of a `Deno.funlock` call"],
"op_fs_funlock_async" => ["unlock a file", "awaiting the result of a `Deno.FsFile.unlock` call"],
"op_fs_link_async" => ["create a hard link", "awaiting the result of a `Deno.link` call"],
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts
index e861b876e..d118aca6e 100644
--- a/cli/tsc/dts/lib.deno.ns.d.ts
+++ b/cli/tsc/dts/lib.deno.ns.d.ts
@@ -5194,97 +5194,6 @@ declare namespace Deno {
): void;
/**
- * Truncates or extends the specified file stream, to reach the specified
- * `len`.
- *
- * If `len` is not specified then the entire file contents are truncated as if
- * `len` was set to `0`.
- *
- * If the file previously was larger than this new length, the extra data is
- * lost.
- *
- * If the file previously was shorter, it is extended, and the extended part
- * reads as null bytes ('\0').
- *
- * ### Truncate the entire file
- *
- * ```ts
- * const file = await Deno.open(
- * "my_file.txt",
- * { read: true, write: true, create: true }
- * );
- * await Deno.ftruncate(file.rid);
- * ```
- *
- * ### Truncate part of the file
- *
- * ```ts
- * const file = await Deno.open(
- * "my_file.txt",
- * { read: true, write: true, create: true }
- * );
- * await file.write(new TextEncoder().encode("Hello World"));
- * await Deno.ftruncate(file.rid, 7);
- * const data = new Uint8Array(32);
- * await Deno.read(file.rid, data);
- * console.log(new TextDecoder().decode(data)); // Hello W
- * ```
- *
- * @deprecated This will be removed in Deno 2.0. See the
- * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
- * for migration instructions.
- *
- * @category File System
- */
- export function ftruncate(rid: number, len?: number): Promise<void>;
-
- /**
- * Synchronously truncates or extends the specified file stream, to reach the
- * specified `len`.
- *
- * If `len` is not specified then the entire file contents are truncated as if
- * `len` was set to `0`.
- *
- * If the file previously was larger than this new length, the extra data is
- * lost.
- *
- * If the file previously was shorter, it is extended, and the extended part
- * reads as null bytes ('\0').
- *
- * ### Truncate the entire file
- *
- * ```ts
- * const file = Deno.openSync(
- * "my_file.txt",
- * { read: true, write: true, truncate: true, create: true }
- * );
- * Deno.ftruncateSync(file.rid);
- * ```
- *
- * ### Truncate part of the file
- *
- * ```ts
- * const file = Deno.openSync(
- * "my_file.txt",
- * { read: true, write: true, create: true }
- * );
- * file.writeSync(new TextEncoder().encode("Hello World"));
- * Deno.ftruncateSync(file.rid, 7);
- * Deno.seekSync(file.rid, 0, Deno.SeekMode.Start);
- * const data = new Uint8Array(32);
- * Deno.readSync(file.rid, data);
- * console.log(new TextDecoder().decode(data)); // Hello W
- * ```
- *
- * @deprecated This will be removed in Deno 2.0. See the
- * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
- * for migration instructions.
- *
- * @category File System
- */
- export function ftruncateSync(rid: number, len?: number): void;
-
- /**
* Synchronously changes the access (`atime`) and modification (`mtime`) times
* of a file system object referenced by `path`. Given times are either in
* seconds (UNIX epoch time) or as `Date` objects.
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js
index 87607ca28..35bf0e712 100644
--- a/ext/fs/30_fs.js
+++ b/ext/fs/30_fs.js
@@ -19,11 +19,11 @@ import {
op_fs_fdatasync_sync,
op_fs_file_stat_async,
op_fs_file_stat_sync,
+ op_fs_file_truncate_async,
op_fs_flock_async,
op_fs_flock_sync,
op_fs_fsync_async,
op_fs_fsync_sync,
- op_fs_ftruncate_async,
op_fs_ftruncate_sync,
op_fs_funlock_async,
op_fs_funlock_async_unstable,
@@ -422,14 +422,6 @@ function coerceLen(len) {
return len;
}
-function ftruncateSync(rid, len) {
- op_fs_ftruncate_sync(rid, coerceLen(len));
-}
-
-async function ftruncate(rid, len) {
- await op_fs_ftruncate_async(rid, coerceLen(len));
-}
-
function truncateSync(path, len) {
op_fs_truncate_sync(path, coerceLen(len));
}
@@ -655,11 +647,11 @@ class FsFile {
}
truncate(len) {
- return ftruncate(this.#rid, len);
+ return op_fs_file_truncate_async(this.#rid, coerceLen(len));
}
truncateSync(len) {
- return ftruncateSync(this.#rid, len);
+ return op_fs_ftruncate_sync(this.#rid, coerceLen(len));
}
read(p) {
@@ -962,8 +954,6 @@ export {
FsFile,
fsync,
fsyncSync,
- ftruncate,
- ftruncateSync,
funlock,
funlockSync,
link,
diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs
index be43c81d9..7cf5f6cb3 100644
--- a/ext/fs/lib.rs
+++ b/ext/fs/lib.rs
@@ -242,7 +242,7 @@ deno_core::extension!(deno_fs,
op_fs_funlock_async,
op_fs_funlock_sync,
op_fs_ftruncate_sync,
- op_fs_ftruncate_async,
+ op_fs_file_truncate_async,
op_fs_futime_sync,
op_fs_futime_async,
diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs
index 7d28b56b0..acf2c216f 100644
--- a/ext/fs/ops.rs
+++ b/ext/fs/ops.rs
@@ -1569,7 +1569,7 @@ pub fn op_fs_ftruncate_sync(
}
#[op2(async)]
-pub async fn op_fs_ftruncate_async(
+pub async fn op_fs_file_truncate_async(
state: Rc<RefCell<OpState>>,
#[smi] rid: ResourceId,
#[number] len: u64,
diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js
index f453563ea..a4baedb49 100644
--- a/runtime/js/90_deno_ns.js
+++ b/runtime/js/90_deno_ns.js
@@ -77,22 +77,6 @@ const denoNs = {
lstat: fs.lstat,
truncateSync: fs.truncateSync,
truncate: fs.truncate,
- ftruncateSync(rid, len) {
- internals.warnOnDeprecatedApi(
- "Deno.ftruncateSync()",
- new Error().stack,
- "Use `Deno.FsFile.truncateSync()` instead.",
- );
- return fs.ftruncateSync(rid, len);
- },
- ftruncate(rid, len) {
- internals.warnOnDeprecatedApi(
- "Deno.ftruncate()",
- new Error().stack,
- "Use `Deno.FsFile.truncate()` instead.",
- );
- return fs.ftruncate(rid, len);
- },
errors: errors.errors,
inspect: console.inspect,
env: os.env,
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index ba010e368..e2b1559e7 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -802,8 +802,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
delete globalThis.window;
delete Deno.Buffer;
delete Deno.File;
- delete Deno.ftruncate;
- delete Deno.ftruncateSync;
delete Deno.FsFile.prototype.rid;
delete Deno.funlock;
delete Deno.funlockSync;
@@ -975,8 +973,6 @@ function bootstrapWorkerRuntime(
if (future) {
delete Deno.Buffer;
delete Deno.File;
- delete Deno.ftruncate;
- delete Deno.ftruncateSync;
delete Deno.FsFile.prototype.rid;
delete Deno.funlock;
delete Deno.funlockSync;
diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js
index a2c530324..9ab96e582 100644
--- a/tests/specs/future/runtime_api/main.js
+++ b/tests/specs/future/runtime_api/main.js
@@ -1,8 +1,6 @@
console.log("window is", globalThis.window);
console.log("Deno.Buffer is", Deno.Buffer);
console.log("Deno.File is", Deno.File);
-console.log("Deno.ftruncate is", Deno.ftruncate);
-console.log("Deno.ftruncateSync is", Deno.ftruncateSync);
console.log(
"Deno.FsFile.prototype.rid is",
Deno.openSync(import.meta.filename).rid,
diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out
index 8175777e1..7cc4cdf15 100644
--- a/tests/specs/future/runtime_api/main.out
+++ b/tests/specs/future/runtime_api/main.out
@@ -1,8 +1,6 @@
window is undefined
Deno.Buffer is undefined
Deno.File is undefined
-Deno.ftruncate is undefined
-Deno.ftruncateSync is undefined
Deno.FsFile.prototype.rid is undefined
Deno.funlock is undefined
Deno.funlockSync is undefined