Skip to main content
promises.open - node__fs.d.ts - Node documentation
function promises.open

Usage in Deno

```typescript import { promises } from "node:node__fs.d.ts"; ```
open(
path: PathLike,
flags?: string | number,
mode?: Mode,
): Promise<FileHandle>
Opens a `FileHandle`. Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail. Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams).

Parameters

path: PathLike
optional
flags: string | number = 'r'
See `support of file system `flags``.
optional
mode: Mode = 0o666
Sets the file mode (permission and sticky bits) if the file is created.

Return Type

Promise<FileHandle>
Fulfills with a {FileHandle} object.