mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
feat: stabilize Deno.futime() and Deno.futimeSync() (#16415)
This commit is contained in:
parent
3f22f912ec
commit
ffff814540
5 changed files with 38 additions and 48 deletions
|
@ -37,8 +37,6 @@ const UNSTABLE_DENO_PROPS: &[&str] = &[
|
|||
"connect",
|
||||
"consoleSize",
|
||||
"createHttpClient",
|
||||
"futime",
|
||||
"futimeSync",
|
||||
"kill",
|
||||
"listen",
|
||||
"listenDatagram",
|
||||
|
|
36
cli/dts/lib.deno.ns.d.ts
vendored
36
cli/dts/lib.deno.ns.d.ts
vendored
|
@ -3962,6 +3962,42 @@ declare namespace Deno {
|
|||
*/
|
||||
export function ftruncate(rid: number, len?: number): Promise<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());
|
||||
* ```
|
||||
*
|
||||
* @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());
|
||||
* ```
|
||||
*
|
||||
* @category File System
|
||||
*/
|
||||
export function futime(
|
||||
rid: number,
|
||||
atime: number | Date,
|
||||
mtime: number | Date,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
* Synchronously returns a `Deno.FileInfo` for the given file stream.
|
||||
*
|
||||
|
|
42
cli/dts/lib.deno.unstable.d.ts
vendored
42
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -980,48 +980,6 @@ declare namespace Deno {
|
|||
options: CreateHttpClientOptions,
|
||||
): HttpClient;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* 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());
|
||||
* ```
|
||||
*
|
||||
* Needs investigation into high precision time.
|
||||
*
|
||||
* @category File System
|
||||
*/
|
||||
export function futimeSync(
|
||||
rid: number,
|
||||
atime: number | Date,
|
||||
mtime: number | Date,
|
||||
): void;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* 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());
|
||||
* ```
|
||||
*
|
||||
* Needs investigation into high precision time.
|
||||
*
|
||||
* @category File System
|
||||
*/
|
||||
export function futime(
|
||||
rid: number,
|
||||
atime: number | Date,
|
||||
mtime: number | Date,
|
||||
): Promise<void>;
|
||||
|
||||
/** **UNSTABLE**: New API, yet to be vetted.
|
||||
*
|
||||
* A generic transport listener for message-oriented protocols.
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
truncate: __bootstrap.fs.truncate,
|
||||
ftruncateSync: __bootstrap.fs.ftruncateSync,
|
||||
ftruncate: __bootstrap.fs.ftruncate,
|
||||
futime: __bootstrap.fs.futime,
|
||||
futimeSync: __bootstrap.fs.futimeSync,
|
||||
errors: __bootstrap.errors.errors,
|
||||
// TODO(kt3k): Remove this export at v2
|
||||
// See https://github.com/denoland/deno/issues/9294
|
||||
|
@ -128,8 +130,6 @@
|
|||
getUid: __bootstrap.os.getUid,
|
||||
listenDatagram: __bootstrap.net.listenDatagram,
|
||||
umask: __bootstrap.fs.umask,
|
||||
futime: __bootstrap.fs.futime,
|
||||
futimeSync: __bootstrap.fs.futimeSync,
|
||||
utime: __bootstrap.fs.utime,
|
||||
utimeSync: __bootstrap.fs.utimeSync,
|
||||
HttpClient: __bootstrap.fetch.HttpClient,
|
||||
|
|
|
@ -1916,7 +1916,6 @@ fn op_futime_sync(
|
|||
mtime_secs: i64,
|
||||
mtime_nanos: u32,
|
||||
) -> Result<(), AnyError> {
|
||||
super::check_unstable(state, "Deno.futimeSync");
|
||||
let atime = filetime::FileTime::from_unix_time(atime_secs, atime_nanos);
|
||||
let mtime = filetime::FileTime::from_unix_time(mtime_secs, mtime_nanos);
|
||||
|
||||
|
@ -1937,7 +1936,6 @@ async fn op_futime_async(
|
|||
mtime_secs: i64,
|
||||
mtime_nanos: u32,
|
||||
) -> Result<(), AnyError> {
|
||||
super::check_unstable2(&state, "Deno.futime");
|
||||
let atime = filetime::FileTime::from_unix_time(atime_secs, atime_nanos);
|
||||
let mtime = filetime::FileTime::from_unix_time(mtime_secs, mtime_nanos);
|
||||
|
||||
|
|
Loading…
Reference in a new issue