Utf8Stream
Defined in: src/node/utf8stream.ts:105
An optimized UTF-8 stream writer that allows for flushing all of the internal buffering on demand.
Extends
Section titled “Extends”EventEmitter<fs.Utf8StreamEventMap>
Implements
Section titled “Implements”EventEmitterUtf8Stream
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Utf8Stream(
options?):Utf8Stream
Defined in: src/node/utf8stream.ts:150
Parameters
Section titled “Parameters”options?
Section titled “options?”Utf8StreamOptions = {}
Returns
Section titled “Returns”Utf8Stream
Overrides
Section titled “Overrides”EventEmitter<fs.Utf8StreamEventMap>.constructor
Properties
Section titled “Properties”constructor
Section titled “constructor”constructor: typeof
Utf8Stream
Defined in: src/node/utf8stream.ts:137
The initial value of Object.prototype.constructor is the standard built-in Object constructor.
[kUtf8StreamFS]
Section titled “[kUtf8StreamFS]”
static[kUtf8StreamFS]:FS=_utf8StreamFS
Defined in: src/node/utf8stream.ts:138
prefixed
Section titled “prefixed”
staticprefixed:string|boolean
Defined in: node_modules/eventemitter3/index.d.ts:9
Inherited from
Section titled “Inherited from”EventEmitter.prefixed
Accessors
Section titled “Accessors”append
Section titled “append”Get Signature
Section titled “Get Signature”get append():
boolean
Defined in: src/node/utf8stream.ts:473
Whether the stream is appending to the file or truncating it
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”fs.Utf8Stream.append
contentMode
Section titled “contentMode”Get Signature
Section titled “Get Signature”get contentMode():
"buffer"|"utf8"
Defined in: src/node/utf8stream.ts:483
The type of data that can be written to the stream
Returns
Section titled “Returns”"buffer" | "utf8"
Implementation of
Section titled “Implementation of”fs.Utf8Stream.contentMode
Get Signature
Section titled “Get Signature”get fd():
number
Defined in: src/node/utf8stream.ts:440
The file descriptor that is being written to
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”fs.Utf8Stream.fd
Get Signature
Section titled “Get Signature”get file():
string
Defined in: src/node/utf8stream.ts:435
The file that is being written to
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”fs.Utf8Stream.file
Get Signature
Section titled “Get Signature”get fsync():
boolean
Defined in: src/node/utf8stream.ts:468
Whether the stream performs a fsyncSync after every write
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”fs.Utf8Stream.fsync
maxLength
Section titled “maxLength”Get Signature
Section titled “Get Signature”get maxLength():
number
Defined in: src/node/utf8stream.ts:453
The maximum length of the internal buffer.
If a write would cause the buffer to exceed this, the data is dropped and a drop event is emitted with it.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”fs.Utf8Stream.maxLength
minLength
Section titled “minLength”Get Signature
Section titled “Get Signature”get minLength():
number
Defined in: src/node/utf8stream.ts:445
The minimum length of the internal buffer that is required to be full before flushing
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”fs.Utf8Stream.minLength
Get Signature
Section titled “Get Signature”get mkdir():
boolean
Defined in: src/node/utf8stream.ts:488
Whether the directory for file is created if it does not exist
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”fs.Utf8Stream.mkdir
Get Signature
Section titled “Get Signature”get mode():
Mode
Defined in: src/node/utf8stream.ts:430
The mode of the file that is being written to
Returns
Section titled “Returns”Mode
Implementation of
Section titled “Implementation of”fs.Utf8Stream.mode
periodicFlush
Section titled “periodicFlush”Get Signature
Section titled “Get Signature”get periodicFlush():
number
Defined in: src/node/utf8stream.ts:478
The number of milliseconds between flushes. 0 means no periodic flushes are performed.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”fs.Utf8Stream.periodicFlush
Get Signature
Section titled “Get Signature”get sync():
boolean
Defined in: src/node/utf8stream.ts:463
Whether the stream is writing synchronously or asynchronously
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”fs.Utf8Stream.sync
writing
Section titled “writing”Get Signature
Section titled “Get Signature”get writing():
boolean
Defined in: src/node/utf8stream.ts:458
Whether the stream is currently writing data to the file
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”fs.Utf8Stream.writing
Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: src/node/utf8stream.ts:492
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”fs.Utf8Stream.[dispose]
addListener()
Section titled “addListener()”addListener<
T>(event,fn,context?):this
Defined in: src/node/utf8stream.ts:739
Type Parameters
Section titled “Type Parameters”T extends keyof Utf8StreamEventMap
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
Returns
Section titled “Returns”this
Implementation of
Section titled “Implementation of”NodeEventEmitter.addListener
Overrides
Section titled “Overrides”EventEmitter.addListener
destroy()
Section titled “destroy()”destroy():
void
Defined in: src/node/utf8stream.ts:424
Close the stream immediately, without flushing the internal buffer.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”fs.Utf8Stream.destroy
emit()
Section titled “emit()”emit<
T>(event, …args):boolean
Defined in: node_modules/eventemitter3/index.d.ts:32
Calls each of the listeners registered for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof Utf8StreamEventMap
Parameters
Section titled “Parameters”T
…ArgumentMap<Utf8StreamEventMap>[Extract<T, keyof Utf8StreamEventMap>]
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”NodeEventEmitter.emit
Inherited from
Section titled “Inherited from”EventEmitter.emit
end():
void
Defined in: src/node/utf8stream.ts:403
Close the stream gracefully, flushing the internal buffer before closing.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”fs.Utf8Stream.end
eventNames()
Section titled “eventNames()”eventNames(): keyof
Utf8StreamEventMap[]
Defined in: node_modules/eventemitter3/index.d.ts:15
Return an array listing the events for which the emitter has registered listeners.
Returns
Section titled “Returns”keyof Utf8StreamEventMap[]
Implementation of
Section titled “Implementation of”NodeEventEmitter.eventNames
Inherited from
Section titled “Inherited from”EventEmitter.eventNames
flush()
Section titled “flush()”flush(
cb?):void
Defined in: src/node/utf8stream.ts:285
Writes the current buffer to the file if a write was not in progress.
Does nothing if minLength is zero or if it is already writing.
Parameters
Section titled “Parameters”((err) => void) | null
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”fs.Utf8Stream.flush
flushSync()
Section titled “flushSync()”flushSync():
void
Defined in: src/node/utf8stream.ts:315
Flushes the buffered data synchronously. This is a costly operation.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”fs.Utf8Stream.flushSync
getMaxListeners()
Section titled “getMaxListeners()”getMaxListeners():
never
Defined in: src/node/utf8stream.ts:760
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to
events.defaultMaxListeners.
Returns
Section titled “Returns”never
v1.0.0
Implementation of
Section titled “Implementation of”NodeEventEmitter.getMaxListeners
listenerCount()
Section titled “listenerCount()”listenerCount(
event):number
Defined in: node_modules/eventemitter3/index.d.ts:27
Return the number of listeners listening to a given event.
Parameters
Section titled “Parameters”keyof Utf8StreamEventMap
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”NodeEventEmitter.listenerCount
Inherited from
Section titled “Inherited from”EventEmitter.listenerCount
listeners()
Section titled “listeners()”listeners<
T>(event): (…args) =>void[]
Defined in: node_modules/eventemitter3/index.d.ts:20
Return the listeners registered for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof Utf8StreamEventMap
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”(…args) => void[]
Implementation of
Section titled “Implementation of”NodeEventEmitter.listeners
Inherited from
Section titled “Inherited from”EventEmitter.listeners
off<
T>(event,fn?,context?,once?):this
Defined in: src/node/utf8stream.ts:748
Type Parameters
Section titled “Type Parameters”T extends keyof Utf8StreamEventMap
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
boolean
Returns
Section titled “Returns”this
Implementation of
Section titled “Implementation of”NodeEventEmitter.off
Overrides
Section titled “Overrides”EventEmitter.off
on<
T>(event,fn,context?):this
Defined in: src/node/utf8stream.ts:734
Add a listener for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof Utf8StreamEventMap
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
Returns
Section titled “Returns”this
Implementation of
Section titled “Implementation of”NodeEventEmitter.on
Overrides
Section titled “Overrides”EventEmitter.on
once()
Section titled “once()”once<
T>(event,fn,context?):this
Defined in: src/node/utf8stream.ts:743
Add a one-time listener for a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof Utf8StreamEventMap
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
Returns
Section titled “Returns”this
Implementation of
Section titled “Implementation of”NodeEventEmitter.once
Overrides
Section titled “Overrides”EventEmitter.once
prependListener()
Section titled “prependListener()”prependListener():
never
Defined in: src/node/utf8stream.ts:764
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple
times.
server.prependListener('connection', (stream) => { console.log('someone connected!');});Returns a reference to the EventEmitter, so that calls can be chained.
Returns
Section titled “Returns”never
v6.0.0
Implementation of
Section titled “Implementation of”NodeEventEmitter.prependListener
prependOnceListener()
Section titled “prependOnceListener()”prependOnceListener():
never
Defined in: src/node/utf8stream.ts:768
Adds a one-time listener function for the event named eventName to the
beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => { console.log('Ah, we have our first user!');});Returns a reference to the EventEmitter, so that calls can be chained.
Returns
Section titled “Returns”never
v6.0.0
Implementation of
Section titled “Implementation of”NodeEventEmitter.prependOnceListener
rawListeners()
Section titled “rawListeners()”rawListeners():
never
Defined in: src/node/utf8stream.ts:772
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';const emitter = new EventEmitter();emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property// `listener` which contains the original listener bound aboveconst listeners = emitter.rawListeners('log');const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` eventlogFnWrapper.listener();
// Logs "log once" to the console and removes the listenerlogFnWrapper();
emitter.on('log', () => console.log('log persistently'));// Will return a new Array with a single function bound by `.on()` aboveconst newListeners = emitter.rawListeners('log');
// Logs "log persistently" twicenewListeners[0]();emitter.emit('log');Returns
Section titled “Returns”never
v9.4.0
Implementation of
Section titled “Implementation of”NodeEventEmitter.rawListeners
removeAllListeners()
Section titled “removeAllListeners()”removeAllListeners(
event?):this
Defined in: node_modules/eventemitter3/index.d.ts:79
Remove all listeners, or those of the specified event.
Parameters
Section titled “Parameters”event?
Section titled “event?”keyof Utf8StreamEventMap
Returns
Section titled “Returns”this
Implementation of
Section titled “Implementation of”NodeEventEmitter.removeAllListeners
Inherited from
Section titled “Inherited from”EventEmitter.removeAllListeners
removeListener()
Section titled “removeListener()”removeListener<
T>(event,fn?,context?,once?):this
Defined in: src/node/utf8stream.ts:752
Remove the listeners of a given event.
Type Parameters
Section titled “Type Parameters”T extends keyof Utf8StreamEventMap
Parameters
Section titled “Parameters”T
(…args) => void
context?
Section titled “context?”any
boolean
Returns
Section titled “Returns”this
Implementation of
Section titled “Implementation of”NodeEventEmitter.removeListener
Overrides
Section titled “Overrides”EventEmitter.removeListener
reopen()
Section titled “reopen()”reopen(
file?):void
Defined in: src/node/utf8stream.ts:372
Reopen the file in place, useful for log rotation.
Parameters
Section titled “Parameters”PathLike
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”fs.Utf8Stream.reopen
setMaxListeners()
Section titled “setMaxListeners()”setMaxListeners():
never
Defined in: src/node/utf8stream.ts:756
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to
Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Returns
Section titled “Returns”never
v0.3.5
Implementation of
Section titled “Implementation of”NodeEventEmitter.setMaxListeners
write()
Section titled “write()”write(
data):boolean
Defined in: src/node/utf8stream.ts:241
When contentMode is utf8, data must be a string. When it is buffer, data must be a Buffer.
Parameters
Section titled “Parameters”string | Buffer<ArrayBufferLike>
Returns
Section titled “Returns”boolean
Whether the internal buffer is below the high water mark
Implementation of
Section titled “Implementation of”fs.Utf8Stream.write