Function open

  • Opens the file at the given path. Opening flags:

    • r: open for reading
    • w: open for writing, truncating the file if it exists
    • x: open with exclusive creation, will fail if the file exists
    • a: open for writing, appending at the end if the file exists
    • +: open for updating (reading and writing)
    const f = await'file.txt', 'r');


    • path: string

      The path to the file to be opened.

    • flags: string

      Flags with which to open the file.

    • Optional mode: number

      File mode bits applied if the file is created. Defaults to 0o666.

    Returns Promise<FileHandle>

Generated using TypeDoc