Skip to content

Is there a FileHandle class #3523

@lil5

Description

@lil5
  • Node.js Version: v16.8.0
  • OS: Linux mint 20.2
  • Scope (install, code, runtime, meta, other?): Typescript definitions and Documentation
  • Module (and version) (if relevant): n/a

I am trying to create a test to see if a variable contains a fs.FileHandle.

import fs, { promises as fsp } from "fs"

const f = await fsp.open(fpath, "a+")
expect(f).toBeInstanceOf(fs.FileHandle)

Problem
I can't see to find the class FileHandle, neither in fs nor fs.promises.

https://nodejs.org/api/fs.html#fs_class_filehandle
This documentation states that FileHandle is a class.

I have found the FileHandle interface in fs.promises but I'm interested in using instanceof <class>.

Question
Is there a FileHandle class and where is it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    answered🎉 Yay! The issue has been resolved, or the question has been answered.question

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions