Skip to main content

Definitions

~ShiftBufferCallback : function

Shift Function

Kind: inner typedef

ParamTypeDescription
shiftedBuffer | anyshifted bytes

~BufferParseCallback : Promise.<any> | any

Kind: inner typedef Returns: Promise.<any> | any - the promise should be resolved with the parsed object

ParamTypeDescription
chunkBufferthe transformed chunk

~MapCallback : Promise.<any> | any

Kind: inner typedef Returns: Promise.<any> | any - the mapped object

ParamTypeDescription
chunkanythe chunk to be mapped

~FilterCallback : Promise.<Boolean> | Boolean

Kind: inner typedef Returns: Promise.<Boolean> | Boolean - information if the object should remain in the filtered stream.

ParamTypeDescription
chunkanythe chunk to be filtered or not

~ReduceCallback : Promise.<any> | any

Kind: inner typedef Returns: Promise.<any> | any - accumulator for the next pass

ParamTypeDescription
accumulatoranythe accumulator - the object initially passed or returned by the previous reduce operation
chunkobjectthe stream chunk.

~DoCallback : Promise.<any> | any ⇄

Kind: inner typedef Returns: Promise.<any> | any - the outcome is discarded

ParamTypeDescription
chunkobjectsource stream chunk

~IntoCallback : Promise.<any> | any ⇄

Kind: inner typedef Returns: Promise.<any> | any - resolution for the old stream (for flow control only)

ParamTypeDescription
into*stream passed to the into method
chunkanysource stream chunk

~UseCallback : DataStream ⇄

Kind: inner typedef

ParamType
streamDataStream
...parametersArray.<any>

~TeeCallback : function

Kind: inner typedef

ParamTypeDescription
teedDataStreamThe teed stream

~ScramjetTransformCallback : Promise.<(any|undefined)> | any | undefined

Transform async callback. The passed transform should return a new chunk, unless the output should be filtered - if so, the transform should return undefined.

Additionally the function can reject with DataStream.filter - the result will be filtered and no other transforms will be run on the chunk.

Kind: inner typedef Returns: Promise.<(any|undefined)> | any | undefined - the result, undefined will be treated as filtered out.

ParamTypeDescription
chunkBuffer | string | anythe stream chunk
encodingstringencoding of the chunk

~ScramjetWriteCallback : Promise.<void> | void

Write async callback. Await your async write and resolve.

Kind: inner typedef Returns: Promise.<void> | void - should resolve when the write ends

ParamTypeDescription
chunkBuffer | string | anythe stream chunk
encodingstringencoding of the chunk

~ScramjetReadCallback : Array.<any> | Promise.<Array.<any>>

Read async callback. Simply await your async operations and return the result as array.

Kind: inner typedef Returns: Array.<any> | Promise.<Array.<any>> - the read chunk.

ParamTypeDescription
countnumberthe number of chunks that should be read ("this is more like a set of guideline than actual rules").

~DataStreamOptions : object

Standard options for scramjet streams.

Defines async transforms or read/write methods for a stream.

Kind: inner typedef Properties

NameTypeDefaultDescription
[promiseRead]ScramjetReadCallbackan async function returning the next read item
[promiseWrite]ScramjetWriteCallbackan async function writing the next written item
[promiseTransform]ScramjetTransformCallbackan async function returning a transformed chunk
[promiseFlush]ScramjetReadCallbackan async function run before transform stream ends to push last chunks from the buffer
[beforeTransform]ScramjetTransformCallbackan async function run before the transform
[afterTransform]ScramjetTransformCallbackan async function run after the transform
[maxParallel]numberos.cpus.length*2the number of transforms done in parallel
[referrer]DataStreama referring stream to point to (if possible the transforms will be pushed to it
[objectMode]booleantrueshould the object mode be used instead of creating a new stream)
[highWaterMark]numberThe maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. Default: 16384 (16KB), or 16 for objectMode streams.
[encoding]stringIf specified, then buffers will be decoded to strings using the specified encoding. Default: null.
[emitClose]booleanWhether or not the stream should emit 'close' after it has been destroyed. Default: true.
[read]functionImplementation for the stream._read() method.
[destroy]functionImplementation for the stream._destroy() method.
[construct]functionImplementation for the stream._construct() method.
[autoDestroy]booleanWhether this stream should automatically call .destroy() on itself after ending. Default: true.

~ShiftCallback : function

Shift Function

Kind: inner typedef

ParamTypeDescription
shiftedArray.<object> | anyan array of shifted chunks

~AccumulateCallback : Promise.<any> | *

Kind: inner typedef Returns: Promise.<any> | * - resolved when all operations are completed

ParamTypeDescription
accumulator*Accumulator passed to accumulate function
chunk*the stream chunk

~ConsumeCallback : Promise.<any> | *

Kind: inner typedef Returns: Promise.<any> | * - resolved when all operations are completed

ParamTypeDescription
chunk*the stream chunk

~RemapCallback : Promise.<any> | *

Kind: inner typedef Returns: Promise.<any> | * - promise to be resolved when chunk has been processed

ParamTypeDescription
emitfunctiona method to emit objects in the remapped stream
chunk*the chunk from the original stream

~FlatMapCallback : AsyncGenerator.<any, void, any> | Promise.<Iterable.<any>> | Iterable.<any>

Kind: inner typedef Returns: AsyncGenerator.<any, void, any> | Promise.<Iterable.<any>> | Iterable.<any> - promise to be resolved when chunk has been processed

ParamTypeDescription
chunk*the chunk from the original stream

~JoinCallback : Promise.<> |

Kind: inner typedef Returns: Promise.<*> | * - promise that is resolved with the joining item

ParamTypeDescription
previous*the chunk before
next*the chunk after

~AffinityCallback : Symbol | string

Kind: inner typedef

ParamType
chunk*

~DelegateCallback : function

Kind: inner typedef

~RateOptions : object

Kind: inner typedef

ParamTypeDefaultDescription
[timeFrame]number1000The size of the window to look for streams.
[getTime]functionDate.nowTime source - anything that returns time.
[setTimeout]functionsetTimeoutTiming function that works identically to setTimeout.

~ExecDataOptions : object

Kind: inner typedef Extends: StringStream.ExecOptions Properties

NameTypeDescription
[parse]UseCallbackscramjet module to transform the stream to string or buffer stream
[stringify]UseCallbackscramjet module to transform from string or buffer stream to wanted version

~CreateModuleOptions : object

Options for createModule

Kind: inner typedef Properties

NameTypeDescription
StreamClassDataStreamdefines what class should the module assume

~StreamMixin : object

Definition of a single mixin for a specific Scramjet class. Should contain any number of stream methods.

Kind: inner typedef Properties

NameTypeDescription
constructorfunctionoptional constructor that will be called in the stream constructor (this has to be an own property!)

~ScramjetPlugin : object

Definition of a plugin in Scramjet

Kind: inner typedef Internal: Properties

NameTypeDescription
BufferStreamStreamMixindefinition of constructor and properties for the BufferStream prototype.
DataStreamStreamMixindefinition of constructor and properties for the DataStream prototype.
MultiStreamStreamMixindefinition of constructor and properties for the MultiStream prototype.
StringStreamStreamMixindefinition of constructor and properties for the StringStream prototype.

~MultiMapCallback : DataStream ⇄

Kind: inner typedef

ParamType
streamDataStream

~DistributeOptions : object

Distribute options

Kind: inner typedef Properties

NameTypeDefaultDescription
[plugins]Array[]a list of scramjet plugins to load (if omitted, will use just the ones in scramjet itself)
[StreamClass]string"DataStream"the class to deserialize the stream to.
[threads]numberos.cpus().length * 2maximum threads to use - defaults to number of processor threads in os, but it may be sensible to go over this value if you'd intend to run synchronous code.
[createOptions]DataStreamOptionsmaximum threads to use - defaults to number of processor threads in os, but it may be sensible to go over this value if you'd intend to run synchronous code.
[StreamWorker]StreamWorkerscramjet.StreamWorkerworker implementation.

~ValueOfCallback : Promise.<number> | number

Kind: inner typedef Returns: Promise.<number> | number - value of the object

ParamTypeDescription
chunk*stream object

~NumberStreamOptions : object

NumberStream options

Kind: inner typedef Extends: DataStreamOptions Properties

NameTypeDefaultDescription
[valueOf]ValueOfCallbackx => +xvalue of the data item function.

~ShiftStringCallback : function

Kind: inner typedef

ParamTypeDescription
shiftedstring | anyShifted chars

~ParseCallback : Promise.<any> | any

Kind: inner typedef Returns: Promise.<any> | any - the promise should be resolved with the parsed object

ParamTypeDescription
chunkstringthe transformed chunk

~ExecOptions : object

Kind: inner typedef Extends: child_process.SpawnOptions Properties

NameTypeDefaultDescription
[stream]number1(bitwise) the output stdio number to push out (defaults to stdout = 1)
[interpreter]Array.<string>[]defaults to nothing, except on windows where "cmd.exe /c" will be spawned by default

Was it helpful?

Didn't find information needed?

Join our Scramjet Community on Discord, where you can get help from our engineers directly.