Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.85 KB

File metadata and controls

49 lines (39 loc) · 1.85 KB

PipeToOptions

Namespace: SpawnDev.SpawnJS.JSObjects
Source: JSObjects/PipeToOptions.cs
MDN Reference: PipeToOptions on MDN

ReadableStream pipTo options https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo#options

Properties

Property Type Access Description
PipeToOptions class get/set ReadableStream pipTo options https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo#options
PreventAbort bool? get/set
PreventCancel bool? get/set
Signal AbortSignal? get

Examples

SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:

  • Properties and methods use PascalCase (e.g., readyState becomes ReadyState)
  • Events use ActionEvent with +=/-= (e.g., addEventListener("click", fn) becomes OnClick += handler)
  • Async methods return Task<T> instead of Promise<T>
  • Objects should be disposed with using statements
  • Access via JS.Get<PipeToOptions>(...) or constructor new PipeToOptions(...)
// Fetch the original image
fetch("png-logo.png")
  // Retrieve its body as ReadableStream
  .then((response) => response.body)
  .then((body) => body.pipeThrough(new PNGTransformStream()))
  .then((rs) => rs.pipeTo(new FinalDestinationStream()));
(async () => {
  // Fetch the original image
  const response = await fetch("png-logo.png");
  // Retrieve its body as ReadableStream
  await response.body
    .pipeThrough(new PNGTransformStream())
    .pipeTo(new FinalDestinationStream());
})();

See full example on MDN