CipherGCM
[<Interface>]
type CipherGCM =
abstract member ``end`` (chunk: obj, encoding: BufferEncoding, ?cb: (unit -> unit)) : CipherGCM
abstract member ``end`` (chunk: obj, ?cb: (unit -> unit)) : CipherGCM
abstract member ``end`` (?cb: (unit -> unit)) : CipherGCM
abstract member addListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member addListenerClose (listener: unit -> unit) : CipherGCM
abstract member addListenerData (listener: obj -> unit) : CipherGCM
abstract member addListenerDrain (listener: unit -> unit) : CipherGCM
abstract member addListenerEnd (listener: unit -> unit) : CipherGCM
abstract member addListenerError (listener: exn -> unit) : CipherGCM
abstract member addListenerFinish (listener: unit -> unit) : CipherGCM
abstract member addListenerPause (listener: unit -> unit) : CipherGCM
abstract member addListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member addListenerReadable (listener: unit -> unit) : CipherGCM
abstract member addListenerResume (listener: unit -> unit) : CipherGCM
abstract member addListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member compose<'T when 'T :> ReadableStream> (stream: U4<'T,AsyncIterable<'T,obj,obj>,(obj -> unit),Iterable<'T,obj,obj>>, ?options: Options) : 'T
abstract member destroy (?error: exn) : CipherGCM
abstract member getAuthTag () : NonSharedBuffer
abstract member off (eventName: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member on (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member onClose (listener: unit -> unit) : CipherGCM
abstract member onData (listener: obj -> unit) : CipherGCM
abstract member onDrain (listener: unit -> unit) : CipherGCM
abstract member onEnd (listener: unit -> unit) : CipherGCM
abstract member onError (listener: exn -> unit) : CipherGCM
abstract member onFinish (listener: unit -> unit) : CipherGCM
abstract member onPause (listener: unit -> unit) : CipherGCM
abstract member onPipe (listener: Readable -> unit) : CipherGCM
abstract member onReadable (listener: unit -> unit) : CipherGCM
abstract member onResume (listener: unit -> unit) : CipherGCM
abstract member onUnpipe (listener: Readable -> unit) : CipherGCM
abstract member once (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member onceClose (listener: unit -> unit) : CipherGCM
abstract member onceData (listener: obj -> unit) : CipherGCM
abstract member onceDrain (listener: unit -> unit) : CipherGCM
abstract member onceEnd (listener: unit -> unit) : CipherGCM
abstract member onceError (listener: exn -> unit) : CipherGCM
abstract member onceFinish (listener: unit -> unit) : CipherGCM
abstract member oncePause (listener: unit -> unit) : CipherGCM
abstract member oncePipe (listener: Readable -> unit) : CipherGCM
abstract member onceReadable (listener: unit -> unit) : CipherGCM
abstract member onceResume (listener: unit -> unit) : CipherGCM
abstract member onceUnpipe (listener: Readable -> unit) : CipherGCM
abstract member pause () : CipherGCM
abstract member pipe<'T when 'T :> WritableStream> (destination: 'T, ?options: Options) : 'T
abstract member prependListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member prependListenerClose (listener: unit -> unit) : CipherGCM
abstract member prependListenerData (listener: obj -> unit) : CipherGCM
abstract member prependListenerDrain (listener: unit -> unit) : CipherGCM
abstract member prependListenerEnd (listener: unit -> unit) : CipherGCM
abstract member prependListenerError (listener: exn -> unit) : CipherGCM
abstract member prependListenerFinish (listener: unit -> unit) : CipherGCM
abstract member prependListenerPause (listener: unit -> unit) : CipherGCM
abstract member prependListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member prependListenerReadable (listener: unit -> unit) : CipherGCM
abstract member prependListenerResume (listener: unit -> unit) : CipherGCM
abstract member prependListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member prependOnceListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member prependOnceListenerClose (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerData (listener: obj -> unit) : CipherGCM
abstract member prependOnceListenerDrain (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerEnd (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerError (listener: exn -> unit) : CipherGCM
abstract member prependOnceListenerFinish (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerPause (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member prependOnceListenerReadable (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerResume (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member removeAllListeners (?eventName: U2<string,Symbol>) : CipherGCM
abstract member removeListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member removeListenerClose (listener: unit -> unit) : CipherGCM
abstract member removeListenerData (listener: obj -> unit) : CipherGCM
abstract member removeListenerDrain (listener: unit -> unit) : CipherGCM
abstract member removeListenerEnd (listener: unit -> unit) : CipherGCM
abstract member removeListenerError (listener: exn -> unit) : CipherGCM
abstract member removeListenerFinish (listener: unit -> unit) : CipherGCM
abstract member removeListenerPause (listener: unit -> unit) : CipherGCM
abstract member removeListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member removeListenerReadable (listener: unit -> unit) : CipherGCM
abstract member removeListenerResume (listener: unit -> unit) : CipherGCM
abstract member removeListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member resume () : CipherGCM
abstract member setAAD (buffer: U12<BigInt64Array<U2<ArrayBuffer,SharedArrayBuffer>>,BigUint64Array<U2<ArrayBuffer,SharedArrayBuffer>>,DataView<U2<ArrayBuffer,SharedArrayBuffer>>,Float32Array<U2<ArrayBuffer,SharedArrayBuffer>>,Float64Array<U2<ArrayBuffer,SharedArrayBuffer>>,Int16Array<U2<ArrayBuffer,SharedArrayBuffer>>,Int32Array<U2<ArrayBuffer,SharedArrayBuffer>>,Int8Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint16Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint32Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint8Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint8ClampedArray<U2<ArrayBuffer,SharedArrayBuffer>>>, ?options: Options) : CipherGCM
abstract member setAutoPadding (?autoPadding: bool) : CipherGCM
abstract member setDefaultEncoding (encoding: BufferEncoding) : CipherGCM
abstract member setEncoding (encoding: BufferEncoding) : CipherGCM
abstract member setMaxListeners (n: float) : CipherGCM
abstract member unpipe (?destination: WritableStream) : CipherGCM
abstract member wrap (stream: ReadableStream) : CipherGCM| Assembly | Xantham.Fable.Node |
| Implements | Cipher |
Declared inside
Compose | |
Pipe | |
SetAAD |
Methods
abstract member ``end`` (chunk: obj, encoding: BufferEncoding, ?cb: (unit -> unit)) : CipherGCM
abstract member ``end`` (chunk: obj, encoding: BufferEncoding, ?cb: (unit -> unit)) : CipherGCMCalling the writable.end() method signals that no more data will be written to the Writable. The optional chunk and encoding arguments allow one final additional chunk of data to be written immediately before closing the stream.
Calling the write method after calling end will raise an error.
// Write 'hello, ' and then end with 'world!'.
import fs from 'node:fs';
const file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
// Writing more now is not allowed!
Signals that no more data will be written, with one final chunk of data.
@since v0.9.4
| Parameter | |
|---|---|
cb | Callback for when the stream is finished. |
chunk | Optional data to write. For streams not operating in object mode, chunk must be a , , or . For object mode streams, chunk may be any JavaScript value other than null. |
cb | Callback for when the stream is finished. |
chunk | Optional data to write. For streams not operating in object mode, chunk must be a , , or . For object mode streams, chunk may be any JavaScript value other than null. |
encoding | The encoding if chunk is a string |
cb | Callback for when the stream is finished. |
abstract member ``end`` (chunk: obj, ?cb: (unit -> unit)) : CipherGCM
abstract member ``end`` (chunk: obj, ?cb: (unit -> unit)) : CipherGCMCalling the writable.end() method signals that no more data will be written to the Writable. The optional chunk and encoding arguments allow one final additional chunk of data to be written immediately before closing the stream.
Calling the write method after calling end will raise an error.
// Write 'hello, ' and then end with 'world!'.
import fs from 'node:fs';
const file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
// Writing more now is not allowed!
Signals that no more data will be written, with one final chunk of data.
@since v0.9.4
| Parameter | |
|---|---|
cb | Callback for when the stream is finished. |
chunk | Optional data to write. For streams not operating in object mode, chunk must be a , , or . For object mode streams, chunk may be any JavaScript value other than null. |
cb | Callback for when the stream is finished. |
chunk | Optional data to write. For streams not operating in object mode, chunk must be a , , or . For object mode streams, chunk may be any JavaScript value other than null. |
encoding | The encoding if chunk is a string |
cb | Callback for when the stream is finished. |
abstract member ``end`` (?cb: (unit -> unit)) : CipherGCM
abstract member ``end`` (?cb: (unit -> unit)) : CipherGCMCalling the writable.end() method signals that no more data will be written to the Writable. The optional chunk and encoding arguments allow one final additional chunk of data to be written immediately before closing the stream.
Calling the write method after calling end will raise an error.
// Write 'hello, ' and then end with 'world!'.
import fs from 'node:fs';
const file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
// Writing more now is not allowed!
Signals that no more data will be written, with one final chunk of data.
@since v0.9.4
| Parameter | |
|---|---|
cb | Callback for when the stream is finished. |
chunk | Optional data to write. For streams not operating in object mode, chunk must be a , , or . For object mode streams, chunk may be any JavaScript value other than null. |
cb | Callback for when the stream is finished. |
chunk | Optional data to write. For streams not operating in object mode, chunk must be a , , or . For object mode streams, chunk may be any JavaScript value other than null. |
encoding | The encoding if chunk is a string |
cb | Callback for when the stream is finished. |
abstract member addListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member addListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCMEvent emitter The defined events on documents including:
- close
- data
- drain
- end
- error
- finish
- pause
- pipe
- readable
- resume
- unpipe
abstract member addListenerClose (listener: unit -> unit) : CipherGCM
abstract member addListenerClose (listener: unit -> unit) : CipherGCMEvent emitter The defined events on documents including:
- close
- data
- drain
- end
- error
- finish
- pause
- pipe
- readable
- resume
- unpipe
addListener(event: "close", listener: () => void): this
abstract member addListenerData (listener: obj -> unit) : CipherGCM
abstract member addListenerData (listener: obj -> unit) : CipherGCMaddListener(event: "data", listener: (chunk: any) => void): this
abstract member addListenerDrain (listener: unit -> unit) : CipherGCM
abstract member addListenerDrain (listener: unit -> unit) : CipherGCMaddListener(event: "drain", listener: () => void): this
abstract member addListenerEnd (listener: unit -> unit) : CipherGCM
abstract member addListenerEnd (listener: unit -> unit) : CipherGCMaddListener(event: "end", listener: () => void): this
abstract member addListenerError (listener: exn -> unit) : CipherGCM
abstract member addListenerError (listener: exn -> unit) : CipherGCMaddListener(event: "error", listener: (err: Error) => void): this
abstract member addListenerFinish (listener: unit -> unit) : CipherGCM
abstract member addListenerFinish (listener: unit -> unit) : CipherGCMaddListener(event: "finish", listener: () => void): this
abstract member addListenerPause (listener: unit -> unit) : CipherGCM
abstract member addListenerPause (listener: unit -> unit) : CipherGCMaddListener(event: "pause", listener: () => void): this
abstract member addListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member addListenerPipe (listener: Readable -> unit) : CipherGCMaddListener(event: "pipe", listener: (src: Readable) => void): this
abstract member addListenerReadable (listener: unit -> unit) : CipherGCM
abstract member addListenerReadable (listener: unit -> unit) : CipherGCMaddListener(event: "readable", listener: () => void): this
abstract member addListenerResume (listener: unit -> unit) : CipherGCM
abstract member addListenerResume (listener: unit -> unit) : CipherGCMaddListener(event: "resume", listener: () => void): this
abstract member addListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member addListenerUnpipe (listener: Readable -> unit) : CipherGCMaddListener(event: "unpipe", listener: (src: Readable) => void): this
abstract member compose<'T when 'T :> ReadableStream> (stream: U4<'T,AsyncIterable<'T,obj,obj>,(obj -> unit),Iterable<'T,obj,obj>>, ?options: Options) : 'Tabstract member destroy (?error: exn) : CipherGCM
abstract member destroy (?error: exn) : CipherGCMDestroy the stream. Optionally emit an 'error' event, and emit a 'close' event (unless emitClose is set to false). After this call, the readable stream will release any internal resources and subsequent calls to push() will be ignored.
Once destroy() has been called any further calls will be a no-op and no further errors except from _destroy() may be emitted as 'error'.
Implementors should not override this method, but instead implement readable._destroy().
@since v8.0.0
| Parameter | |
|---|---|
error | Error which will be passed as payload in 'error' event |
abstract member getAuthTag () : NonSharedBufferabstract member off (eventName: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member off (eventName: U2<string,Symbol>, listener: obj array -> unit) : CipherGCMAlias for emitter.removeListener().
@since v10.0.0
abstract member on (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member on (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCMAdds the listener function to the end 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.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
abstract member onClose (listener: unit -> unit) : CipherGCM
abstract member onClose (listener: unit -> unit) : CipherGCMon(event: "close", listener: () => void): this
abstract member onData (listener: obj -> unit) : CipherGCM
abstract member onData (listener: obj -> unit) : CipherGCMon(event: "data", listener: (chunk: any) => void): this
abstract member onDrain (listener: unit -> unit) : CipherGCM
abstract member onDrain (listener: unit -> unit) : CipherGCMon(event: "drain", listener: () => void): this
abstract member onEnd (listener: unit -> unit) : CipherGCM
abstract member onEnd (listener: unit -> unit) : CipherGCMon(event: "end", listener: () => void): this
abstract member onError (listener: exn -> unit) : CipherGCM
abstract member onError (listener: exn -> unit) : CipherGCMon(event: "error", listener: (err: Error) => void): this
abstract member onFinish (listener: unit -> unit) : CipherGCM
abstract member onFinish (listener: unit -> unit) : CipherGCMon(event: "finish", listener: () => void): this
abstract member onPause (listener: unit -> unit) : CipherGCM
abstract member onPause (listener: unit -> unit) : CipherGCMon(event: "pause", listener: () => void): this
abstract member onPipe (listener: Readable -> unit) : CipherGCM
abstract member onPipe (listener: Readable -> unit) : CipherGCMon(event: "pipe", listener: (src: Readable) => void): this
abstract member onReadable (listener: unit -> unit) : CipherGCM
abstract member onReadable (listener: unit -> unit) : CipherGCMon(event: "readable", listener: () => void): this
abstract member onResume (listener: unit -> unit) : CipherGCM
abstract member onResume (listener: unit -> unit) : CipherGCMon(event: "resume", listener: () => void): this
abstract member onUnpipe (listener: Readable -> unit) : CipherGCM
abstract member onUnpipe (listener: Readable -> unit) : CipherGCMon(event: "unpipe", listener: (src: Readable) => void): this
abstract member once (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member once (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCMAdds a one-timelistener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
abstract member onceClose (listener: unit -> unit) : CipherGCM
abstract member onceClose (listener: unit -> unit) : CipherGCMonce(event: "close", listener: () => void): this
abstract member onceData (listener: obj -> unit) : CipherGCM
abstract member onceData (listener: obj -> unit) : CipherGCMonce(event: "data", listener: (chunk: any) => void): this
abstract member onceDrain (listener: unit -> unit) : CipherGCM
abstract member onceDrain (listener: unit -> unit) : CipherGCMonce(event: "drain", listener: () => void): this
abstract member onceEnd (listener: unit -> unit) : CipherGCM
abstract member onceEnd (listener: unit -> unit) : CipherGCMonce(event: "end", listener: () => void): this
abstract member onceError (listener: exn -> unit) : CipherGCM
abstract member onceError (listener: exn -> unit) : CipherGCMonce(event: "error", listener: (err: Error) => void): this
abstract member onceFinish (listener: unit -> unit) : CipherGCM
abstract member onceFinish (listener: unit -> unit) : CipherGCMonce(event: "finish", listener: () => void): this
abstract member oncePause (listener: unit -> unit) : CipherGCM
abstract member oncePause (listener: unit -> unit) : CipherGCMonce(event: "pause", listener: () => void): this
abstract member oncePipe (listener: Readable -> unit) : CipherGCM
abstract member oncePipe (listener: Readable -> unit) : CipherGCMonce(event: "pipe", listener: (src: Readable) => void): this
abstract member onceReadable (listener: unit -> unit) : CipherGCM
abstract member onceReadable (listener: unit -> unit) : CipherGCMonce(event: "readable", listener: () => void): this
abstract member onceResume (listener: unit -> unit) : CipherGCM
abstract member onceResume (listener: unit -> unit) : CipherGCMonce(event: "resume", listener: () => void): this
abstract member onceUnpipe (listener: Readable -> unit) : CipherGCM
abstract member onceUnpipe (listener: Readable -> unit) : CipherGCMonce(event: "unpipe", listener: (src: Readable) => void): this
abstract member pause () : CipherGCM
abstract member pause () : CipherGCMThe readable.pause() method will cause a stream in flowing mode to stop emitting 'data' events, switching out of flowing mode. Any data that becomes available will remain in the internal buffer.
const readable = getReadableStreamSomehow();
readable.on('data', (chunk) => {
console.log(`Received ${chunk.length} bytes of data.`);
readable.pause();
console.log('There will be no additional data for 1 second.');
setTimeout(() => {
console.log('Now data will start flowing again.');
readable.resume();
}, 1000);
});
The readable.pause() method has no effect if there is a 'readable' event listener.
@since v0.9.4
abstract member prependListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member prependListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCMAdds 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.
abstract member prependListenerClose (listener: unit -> unit) : CipherGCM
abstract member prependListenerClose (listener: unit -> unit) : CipherGCMprependListener(event: "close", listener: () => void): this
abstract member prependListenerData (listener: obj -> unit) : CipherGCM
abstract member prependListenerData (listener: obj -> unit) : CipherGCMprependListener(event: "data", listener: (chunk: any) => void): this
abstract member prependListenerDrain (listener: unit -> unit) : CipherGCM
abstract member prependListenerDrain (listener: unit -> unit) : CipherGCMprependListener(event: "drain", listener: () => void): this
abstract member prependListenerEnd (listener: unit -> unit) : CipherGCM
abstract member prependListenerEnd (listener: unit -> unit) : CipherGCMprependListener(event: "end", listener: () => void): this
abstract member prependListenerError (listener: exn -> unit) : CipherGCM
abstract member prependListenerError (listener: exn -> unit) : CipherGCMprependListener(event: "error", listener: (err: Error) => void): this
abstract member prependListenerFinish (listener: unit -> unit) : CipherGCM
abstract member prependListenerFinish (listener: unit -> unit) : CipherGCMprependListener(event: "finish", listener: () => void): this
abstract member prependListenerPause (listener: unit -> unit) : CipherGCM
abstract member prependListenerPause (listener: unit -> unit) : CipherGCMprependListener(event: "pause", listener: () => void): this
abstract member prependListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member prependListenerPipe (listener: Readable -> unit) : CipherGCMprependListener(event: "pipe", listener: (src: Readable) => void): this
abstract member prependListenerReadable (listener: unit -> unit) : CipherGCM
abstract member prependListenerReadable (listener: unit -> unit) : CipherGCMprependListener(event: "readable", listener: () => void): this
abstract member prependListenerResume (listener: unit -> unit) : CipherGCM
abstract member prependListenerResume (listener: unit -> unit) : CipherGCMprependListener(event: "resume", listener: () => void): this
abstract member prependListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member prependListenerUnpipe (listener: Readable -> unit) : CipherGCMprependListener(event: "unpipe", listener: (src: Readable) => void): this
abstract member prependOnceListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member prependOnceListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCMAdds a one-timelistener 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.
abstract member prependOnceListenerClose (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerClose (listener: unit -> unit) : CipherGCMprependOnceListener(event: "close", listener: () => void): this
abstract member prependOnceListenerData (listener: obj -> unit) : CipherGCM
abstract member prependOnceListenerData (listener: obj -> unit) : CipherGCMprependOnceListener(event: "data", listener: (chunk: any) => void): this
abstract member prependOnceListenerDrain (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerDrain (listener: unit -> unit) : CipherGCMprependOnceListener(event: "drain", listener: () => void): this
abstract member prependOnceListenerEnd (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerEnd (listener: unit -> unit) : CipherGCMprependOnceListener(event: "end", listener: () => void): this
abstract member prependOnceListenerError (listener: exn -> unit) : CipherGCM
abstract member prependOnceListenerError (listener: exn -> unit) : CipherGCMprependOnceListener(event: "error", listener: (err: Error) => void): this
abstract member prependOnceListenerFinish (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerFinish (listener: unit -> unit) : CipherGCMprependOnceListener(event: "finish", listener: () => void): this
abstract member prependOnceListenerPause (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerPause (listener: unit -> unit) : CipherGCMprependOnceListener(event: "pause", listener: () => void): this
abstract member prependOnceListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member prependOnceListenerPipe (listener: Readable -> unit) : CipherGCMprependOnceListener(event: "pipe", listener: (src: Readable) => void): this
abstract member prependOnceListenerReadable (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerReadable (listener: unit -> unit) : CipherGCMprependOnceListener(event: "readable", listener: () => void): this
abstract member prependOnceListenerResume (listener: unit -> unit) : CipherGCM
abstract member prependOnceListenerResume (listener: unit -> unit) : CipherGCMprependOnceListener(event: "resume", listener: () => void): this
abstract member prependOnceListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member prependOnceListenerUnpipe (listener: Readable -> unit) : CipherGCMprependOnceListener(event: "unpipe", listener: (src: Readable) => void): this
abstract member removeAllListeners (?eventName: U2<string,Symbol>) : CipherGCM
abstract member removeAllListeners (?eventName: U2<string,Symbol>) : CipherGCMRemoves all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
@since v0.1.26
abstract member removeListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCM
abstract member removeListener (event: U2<string,Symbol>, listener: obj array -> unit) : CipherGCMRemoves the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified eventName, then removeListener() must be called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will change the position indices of any listener registered after the listener being removed. This will not impact the order in which listeners are called, but it means that any copies of the listener array as returned by the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single event (as in the example below), removeListener() will remove the most recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
abstract member removeListenerClose (listener: unit -> unit) : CipherGCM
abstract member removeListenerClose (listener: unit -> unit) : CipherGCMremoveListener(event: "close", listener: () => void): this
abstract member removeListenerData (listener: obj -> unit) : CipherGCM
abstract member removeListenerData (listener: obj -> unit) : CipherGCMremoveListener(event: "data", listener: (chunk: any) => void): this
abstract member removeListenerDrain (listener: unit -> unit) : CipherGCM
abstract member removeListenerDrain (listener: unit -> unit) : CipherGCMremoveListener(event: "drain", listener: () => void): this
abstract member removeListenerEnd (listener: unit -> unit) : CipherGCM
abstract member removeListenerEnd (listener: unit -> unit) : CipherGCMremoveListener(event: "end", listener: () => void): this
abstract member removeListenerError (listener: exn -> unit) : CipherGCM
abstract member removeListenerError (listener: exn -> unit) : CipherGCMremoveListener(event: "error", listener: (err: Error) => void): this
abstract member removeListenerFinish (listener: unit -> unit) : CipherGCM
abstract member removeListenerFinish (listener: unit -> unit) : CipherGCMremoveListener(event: "finish", listener: () => void): this
abstract member removeListenerPause (listener: unit -> unit) : CipherGCM
abstract member removeListenerPause (listener: unit -> unit) : CipherGCMremoveListener(event: "pause", listener: () => void): this
abstract member removeListenerPipe (listener: Readable -> unit) : CipherGCM
abstract member removeListenerPipe (listener: Readable -> unit) : CipherGCMremoveListener(event: "pipe", listener: (src: Readable) => void): this
abstract member removeListenerReadable (listener: unit -> unit) : CipherGCM
abstract member removeListenerReadable (listener: unit -> unit) : CipherGCMremoveListener(event: "readable", listener: () => void): this
abstract member removeListenerResume (listener: unit -> unit) : CipherGCM
abstract member removeListenerResume (listener: unit -> unit) : CipherGCMremoveListener(event: "resume", listener: () => void): this
abstract member removeListenerUnpipe (listener: Readable -> unit) : CipherGCM
abstract member removeListenerUnpipe (listener: Readable -> unit) : CipherGCMremoveListener(event: "unpipe", listener: (src: Readable) => void): this
abstract member resume () : CipherGCM
abstract member resume () : CipherGCMThe readable.resume() method causes an explicitly paused Readable stream to resume emitting 'data' events, switching the stream into flowing mode.
The readable.resume() method can be used to fully consume the data from a stream without actually processing any of that data:
getReadableStreamSomehow()
.resume()
.on('end', () => {
console.log('Reached the end, but did not read anything.');
});
The readable.resume() method has no effect if there is a 'readable' event listener.
@since v0.9.4
abstract member setAAD (buffer: U12<BigInt64Array<U2<ArrayBuffer,SharedArrayBuffer>>,BigUint64Array<U2<ArrayBuffer,SharedArrayBuffer>>,DataView<U2<ArrayBuffer,SharedArrayBuffer>>,Float32Array<U2<ArrayBuffer,SharedArrayBuffer>>,Float64Array<U2<ArrayBuffer,SharedArrayBuffer>>,Int16Array<U2<ArrayBuffer,SharedArrayBuffer>>,Int32Array<U2<ArrayBuffer,SharedArrayBuffer>>,Int8Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint16Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint32Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint8Array<U2<ArrayBuffer,SharedArrayBuffer>>,Uint8ClampedArray<U2<ArrayBuffer,SharedArrayBuffer>>>, ?options: Options) : CipherGCMabstract member setAutoPadding (?autoPadding: bool) : CipherGCM
abstract member setAutoPadding (?autoPadding: bool) : CipherGCMWhen using block encryption algorithms, the Cipher class will automatically add padding to the input data to the appropriate block size. To disable the default padding call cipher.setAutoPadding(false).
When autoPadding is false, the length of the entire input data must be a multiple of the cipher's block size or cipher.final() will throw an error. Disabling automatic padding is useful for non-standard padding, for instance using 0x0 instead of PKCS padding.
The cipher.setAutoPadding() method must be called before cipher.final().
@since v0.7.1
Returns. for method chaining.
abstract member setDefaultEncoding (encoding: BufferEncoding) : CipherGCM
abstract member setDefaultEncoding (encoding: BufferEncoding) : CipherGCMThe writable.setDefaultEncoding() method sets the default encoding for a Writable stream.
@since v0.11.15
| Parameter | |
|---|---|
encoding | The new default encoding |
abstract member setEncoding (encoding: BufferEncoding) : CipherGCM
abstract member setEncoding (encoding: BufferEncoding) : CipherGCMThe readable.setEncoding() method sets the character encoding for data read from the Readable stream.
By default, no encoding is assigned and stream data will be returned as Buffer objects. Setting an encoding causes the stream data to be returned as strings of the specified encoding rather than as Buffer objects. For instance, calling readable.setEncoding('utf8') will cause the output data to be interpreted as UTF-8 data, and passed as strings. Calling readable.setEncoding('hex') will cause the data to be encoded in hexadecimal string format.
The Readable stream will properly handle multi-byte characters delivered through the stream that would otherwise become improperly decoded if simply pulled from the stream as Buffer objects.
const readable = getReadableStreamSomehow();
readable.setEncoding('utf8');
readable.on('data', (chunk) => {
assert.equal(typeof chunk, 'string');
console.log('Got %d characters of string data:', chunk.length);
});
@since v0.9.4
| Parameter | |
|---|---|
encoding | The encoding to use. |
abstract member setMaxListeners (n: float) : CipherGCM
abstract member setMaxListeners (n: float) : CipherGCMBy 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.
@since v0.3.5
abstract member unpipe (?destination: WritableStream) : CipherGCM
abstract member unpipe (?destination: WritableStream) : CipherGCMThe readable.unpipe() method detaches a Writable stream previously attached using the pipe method.
If the destination is not specified, then all pipes are detached.
If the destination is specified, but no pipe is set up for it, then the method does nothing.
import fs from 'node:fs';
const readable = getReadableStreamSomehow();
const writable = fs.createWriteStream('file.txt');
// All the data from readable goes into 'file.txt',
// but only for the first second.
readable.pipe(writable);
setTimeout(() => {
console.log('Stop writing to file.txt.');
readable.unpipe(writable);
console.log('Manually close the file stream.');
writable.end();
}, 1000);
@since v0.9.4
| Parameter | |
|---|---|
destination | Optional specific stream to unpipe |
abstract member wrap (stream: ReadableStream) : CipherGCM
abstract member wrap (stream: ReadableStream) : CipherGCMPrior to Node.js 0.10, streams did not implement the entire node:stream module API as it is currently defined. (See Compatibility for more information.)
When using an older Node.js library that emits 'data' events and has a pause method that is advisory only, the readable.wrap() method can be used to create a Readable stream that uses the old stream as its data source.
It will rarely be necessary to use readable.wrap() but the method has been provided as a convenience for interacting with older Node.js applications and libraries.
import { OldReader } from './old-api-module.js';
import { Readable } from 'node:stream';
const oreader = new OldReader();
const myReader = new Readable().wrap(oreader);
myReader.on('readable', () => {
myReader.read(); // etc.
});
@since v0.9.4
| Parameter | |
|---|---|
stream | An "old style" readable stream |