Bun

interface

fs.Utf8StreamOptions

interface Utf8StreamOptions

  • append?: boolean

    Appends writes to dest file instead of truncating it.

  • contentMode?: 'utf8' | 'buffer'

    Which type of data you can send to the write function, supported values are 'utf8' or 'buffer'.

  • dest?: string

    A path to a file to be written to (mode controlled by the append option).

  • fd?: number

    A file descriptor, something that is returned by fs.open() or fs.openSync().

  • fs?: object

    An object that has the same API as the fs module, useful for mocking, testing, or customizing the behavior of the stream.

  • fsync?: boolean

    Perform a fs.fsyncSync() every time a write is completed.

  • maxLength?: number

    The maximum length of the internal buffer. If a write operation would cause the buffer to exceed maxLength, the data written is dropped and a drop event is emitted with the dropped data

  • maxWrite?: number

    The maximum number of bytes that can be written;

  • minLength?: number

    The minimum length of the internal buffer that is required to be full before flushing.

  • mkdir?: boolean

    Ensure directory for dest file exists when true.

  • mode?: string | number

    Specify the creating file mode (see fs.open()).

  • periodicFlush?: number

    Calls flush every periodicFlush milliseconds.

  • retryEAGAIN?: (err: null | Error, writeBufferLen: number, remainingBufferLen: number) => boolean

    A function that will be called when write(), writeSync(), or flushSync() encounters an EAGAIN or EBUSY error. If the return value is true the operation will be retried, otherwise it will bubble the error. The err is the error that caused this function to be called, writeBufferLen is the length of the buffer that was written, and remainingBufferLen is the length of the remaining buffer that the stream did not try to write.

  • sync?: boolean

    Perform writes synchronously.