Flushes a file stream's buffer. Ensures that any data buffered in the stream is written to the file.

Thrown if the environment is not a Node.js server.

Thrown if the file stream to flush does not exist.

Thrown if an unexpected error occurs while flushing the file stream.

  • Parameters

    • filePath: string

      The path to the file of the stream to flush.

    • Optionalcb: ((err?: Error) => unknown)

      Optional callback function to execute after flushing.

        • (err?): unknown
        • Parameters

          • Optionalerr: Error

          Returns unknown

    Returns void