1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-20 20:42:19 -05:00

fix(ext/node): test

This commit is contained in:
zhangyongsheng.dev__dcar 2025-01-15 15:07:08 +08:00
parent a75cd2a9d6
commit 8d195e4d97
4 changed files with 20 additions and 2 deletions

View file

@ -5,6 +5,7 @@
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { FsFile } from "ext:deno_fs/30_fs.js";
import { promisify } from "ext:deno_node/internal/util.mjs";
export function fdatasync(
fd: number,
@ -19,3 +20,7 @@ export function fdatasync(
export function fdatasyncSync(fd: number) {
new FsFile(fd, Symbol.for("Deno.internal.FsFile")).syncDataSync();
}
export const fdatasyncPromise = promisify(fdatasync) as (
fd: number,
) => Promise<void>;

View file

@ -5,6 +5,7 @@
import { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
import { FsFile } from "ext:deno_fs/30_fs.js";
import { promisify } from "ext:deno_node/internal/util.mjs";
export function fsync(
fd: number,
@ -19,3 +20,5 @@ export function fsync(
export function fsyncSync(fd: number) {
new FsFile(fd, Symbol.for("Deno.internal.FsFile")).syncSync();
}
export const fsyncPromise = promisify(fsync) as (fd: number) => Promise<void>;

View file

@ -16,6 +16,8 @@ import {
import { ftruncatePromise } from "ext:deno_node/_fs/_fs_ftruncate.ts";
export type { BigIntStats, Stats } from "ext:deno_node/_fs/_fs_stat.ts";
import { writevPromise, WriteVResult } from "ext:deno_node/_fs/_fs_writev.ts";
import { fdatasyncPromise } from "ext:deno_node/_fs/_fs_fdatasync.ts";
import { fsyncPromise } from "ext:deno_node/_fs/_fs_fsync.ts";
interface WriteResult {
bytesWritten: number;
@ -159,11 +161,11 @@ export class FileHandle extends EventEmitter {
}
datasync(): Promise<void> {
return fsCall(promises.fdatasync, this);
return fsCall(fdatasyncPromise, this);
}
sync(): Promise<void> {
return fsCall(promises.fsync, this);
return fsCall(fsyncPromise, this);
}
utimes(

View file

@ -0,0 +1,8 @@
// deno-fmt-ignore-file
// deno-lint-ignore-file
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
// Taken from Node 20.11.1
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
module.exports = 'perhaps I work';