Type Alias StreamResult

StreamResult: [returnValue: number, dstProduced: number, srcConsumed: number]

Composite return value for streaming (de)compression functions.

These functions effectively return three values:

  • returnValue: the function's normal return value
  • dstProduced: the number of bytes written to the output buffer
  • srcProduced: the number of bytes read from the input buffer

The latter two of these are out parameters in C, and the most efficient way to map that to a JavaScript API is to return a composite value instead. We use a tuple for performance reasons: Node-API (unlike V8) doesn't have an API to efficiently construct objects with a fixed set of properties.