happy-opfs
    Preparing search index...

    Function openWritableFileStream

    • Opens a file and returns a writable stream for writing contents. Useful for writing large files without loading them entirely into memory. The caller is responsible for closing the stream when done.

      Parameters

      • filePath: string

        The absolute path of the file to write.

      • Optionaloptions: WriteOptions

        Optional write options.

      Returns AsyncIOResult<FileSystemWritableFileStream>

      A promise that resolves to an AsyncIOResult containing a FileSystemWritableFileStream.

      1.0.0

      writeFile for general file writing

      (await openWritableFileStream('/path/to/large-file.bin'))
      .inspect(async stream => {
      try {
      await stream.write(new Uint8Array([1, 2, 3]));
      await stream.write(new Uint8Array([4, 5, 6]));
      } finally {
      await stream.close();
      }
      });