diff options
Diffstat (limited to 'ext/node/polyfills/internal_binding/util.ts')
-rw-r--r-- | ext/node/polyfills/internal_binding/util.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/node/polyfills/internal_binding/util.ts b/ext/node/polyfills/internal_binding/util.ts index a2d355c1e..38eeebee0 100644 --- a/ext/node/polyfills/internal_binding/util.ts +++ b/ext/node/polyfills/internal_binding/util.ts @@ -28,10 +28,13 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { notImplemented } from "ext:deno_node/_utils.ts"; +const core = globalThis.Deno.core; +const ops = core.ops; -export function guessHandleType(_fd: number): string { - notImplemented("util.guessHandleType"); +const handleTypes = ["TCP", "TTY", "UDP", "FILE", "PIPE", "UNKNOWN"]; +export function guessHandleType(fd: number): string { + const type = ops.op_node_guess_handle_type(fd); + return handleTypes[type]; } export const ALL_PROPERTIES = 0; |