diff options
-rw-r--r-- | cli/tools/test/fmt.rs | 1 | ||||
-rw-r--r-- | cli/tsc/dts/lib.deno.ns.d.ts | 44 | ||||
-rw-r--r-- | ext/fs/30_fs.js | 42 | ||||
-rw-r--r-- | runtime/js/90_deno_ns.js | 16 | ||||
-rw-r--r-- | tests/unit/utime_test.ts | 45 |
5 files changed, 12 insertions, 136 deletions
diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs index 174155072..e1e7e1fba 100644 --- a/cli/tools/test/fmt.rs +++ b/cli/tools/test/fmt.rs @@ -326,7 +326,6 @@ pub const OP_DETAILS: phf::Map<&'static str, [&'static str; 2]> = phf_map! { "op_fs_ftruncate_async" => ["truncate a file", "awaiting the result of a `Deno.ftruncate` or `Deno.FsFile.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_futime_async" => ["change file timestamps", "awaiting the result of a `Deno.futime` or `Deno.FsFile.utime` call"], "op_fs_link_async" => ["create a hard link", "awaiting the result of a `Deno.link` call"], "op_fs_lstat_async" => ["get file metadata", "awaiting the result of a `Deno.lstat` call"], "op_fs_make_temp_dir_async" => ["create a temporary directory", "awaiting the result of a `Deno.makeTempDir` call"], diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 556799762..7a0146bf0 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -5440,50 +5440,6 @@ declare namespace Deno { export function ftruncateSync(rid: number, len?: number): void; /** - * Synchronously changes the access (`atime`) and modification (`mtime`) times - * of a file stream resource referenced by `rid`. Given times are either in - * seconds (UNIX epoch time) or as `Date` objects. - * - * ```ts - * const file = Deno.openSync("file.txt", { create: true, write: true }); - * Deno.futimeSync(file.rid, 1556495550, new Date()); - * ``` - * - * @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 futimeSync( - rid: number, - atime: number | Date, - mtime: number | Date, - ): void; - - /** - * Changes the access (`atime`) and modification (`mtime`) times of a file - * stream resource referenced by `rid`. Given times are either in seconds - * (UNIX epoch time) or as `Date` objects. - * - * ```ts - * const file = await Deno.open("file.txt", { create: true, write: true }); - * await Deno.futime(file.rid, 1556495550, new Date()); - * ``` - * - * @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 futime( - rid: number, - atime: number | Date, - mtime: number | Date, - ): Promise<void>; - - /** * Returns a `Deno.FileInfo` for the given file stream. * * ```ts diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 767ed11f4..6c09ae97a 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -482,32 +482,6 @@ function toUnixTimeFromEpoch(value) { ]; } -function futimeSync( - rid, - atime, - mtime, -) { - const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime); - const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime); - op_fs_futime_sync(rid, atimeSec, atimeNsec, mtimeSec, mtimeNsec); -} - -async function futime( - rid, - atime, - mtime, -) { - const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime); - const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime); - await op_fs_futime_async( - rid, - atimeSec, - atimeNsec, - mtimeSec, - mtimeNsec, - ); -} - function utimeSync( path, atime, @@ -766,11 +740,21 @@ class FsFile { } async utime(atime, mtime) { - await futime(this.#rid, atime, mtime); + const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime); + const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime); + await op_fs_futime_async( + this.#rid, + atimeSec, + atimeNsec, + mtimeSec, + mtimeNsec, + ); } utimeSync(atime, mtime) { - futimeSync(this.#rid, atime, mtime); + const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime); + const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime); + op_fs_futime_sync(this.#rid, atimeSec, atimeNsec, mtimeSec, mtimeNsec); } isTerminal() { @@ -1004,8 +988,6 @@ export { ftruncateSync, funlock, funlockSync, - futime, - futimeSync, link, linkSync, lstat, diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 1d44f3001..a958108a9 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -93,22 +93,6 @@ const denoNs = { ); return fs.ftruncate(rid, len); }, - async futime(rid, atime, mtime) { - internals.warnOnDeprecatedApi( - "Deno.futime()", - new Error().stack, - "Use `Deno.FsFile.utime()` instead.", - ); - await fs.futime(rid, atime, mtime); - }, - futimeSync(rid, atime, mtime) { - internals.warnOnDeprecatedApi( - "Deno.futimeSync()", - new Error().stack, - "Use `Deno.FsFile.utimeSync()` instead.", - ); - fs.futimeSync(rid, atime, mtime); - }, errors: errors.errors, inspect: console.inspect, env: os.env, diff --git a/tests/unit/utime_test.ts b/tests/unit/utime_test.ts index d5b4b9269..5bbb378cc 100644 --- a/tests/unit/utime_test.ts +++ b/tests/unit/utime_test.ts @@ -1,37 +1,13 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// deno-lint-ignore-file no-deprecated-deno-api - import { assertEquals, assertRejects, assertThrows, - DENO_FUTURE, pathToAbsoluteFileUrl, } from "./test_util.ts"; Deno.test( - { ignore: DENO_FUTURE, permissions: { read: true, write: true } }, - async function futimeSyncSuccess() { - const testDir = await Deno.makeTempDir(); - const filename = testDir + "/file.txt"; - using file = await Deno.open(filename, { - create: true, - write: true, - }); - - const atime = 1000; - const mtime = 50000; - await Deno.futime(file.rid, atime, mtime); - await file.syncData(); - - const fileInfo = Deno.statSync(filename); - assertEquals(fileInfo.atime, new Date(atime * 1000)); - assertEquals(fileInfo.mtime, new Date(mtime * 1000)); - }, -); - -Deno.test( { permissions: { read: true, write: true } }, async function fsFileUtimeSyncSuccess() { const testDir = await Deno.makeTempDir(); @@ -53,27 +29,6 @@ Deno.test( ); Deno.test( - { ignore: DENO_FUTURE, permissions: { read: true, write: true } }, - function futimeSyncSuccess() { - const testDir = Deno.makeTempDirSync(); - const filename = testDir + "/file.txt"; - using file = Deno.openSync(filename, { - create: true, - write: true, - }); - - const atime = 1000; - const mtime = 50000; - Deno.futimeSync(file.rid, atime, mtime); - file.syncDataSync(); - - const fileInfo = Deno.statSync(filename); - assertEquals(fileInfo.atime, new Date(atime * 1000)); - assertEquals(fileInfo.mtime, new Date(mtime * 1000)); - }, -); - -Deno.test( { permissions: { read: true, write: true } }, function futimeSyncSuccess() { const testDir = Deno.makeTempDirSync(); |