Web APIs
WritableStreamDefaultWriter.abort()
Abort a writable stream through its writer, passing the reason to the sink when applicable. Aborting is abnormal termination, not normal closure. Example console output: stopped.
Formal Syntax & Structure
javascript syntaxjavascript
writer.abort([reason])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| reason | any | Abort reason. |
Return Value
Promise<undefined>
Completion of abort.
Working Example
Example Snippetjavascript
(async () => {let observed; const w=new WritableStream({abort(reason){observed=reason}}).getWriter(); await w.abort("stopped"); console.log(observed); w.releaseLock();})()