---
title: WritableStream
summary: This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/globals/interface.WritableStream/
---

**Kind:** Interface  
**Module:** [globals](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/globals/)  
**Package:** @fastly/js-compute 4.0.1  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1927

```javascript
interface WritableStream<W = any>
```

This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.

## Constructor

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1941

```javascript
new WritableStream(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>)
```

The WritableStream class as [specified by WHATWG](https://streams.spec.whatwg.org/#ws-class)

**See also**

- [WritableStream on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream)

**Parameters**

- `underlyingSink`: `UnderlyingSink<W>` (optional)
- `strategy`: `QueuingStrategy<W>` (optional)

## Properties

### locked

**Type:** `boolean`  
**Flags:** read-only  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1928

## Methods

### abort

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1929

```javascript
abort(reason?: any): Promise<void>
```

**Parameters**

- `reason`: `any` (optional)

**Returns**

`Promise<void>`

### getWriter

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/globals.d.ts#L1930

```javascript
getWriter(): WritableStreamDefaultWriter<W>
```

**Returns**

`WritableStreamDefaultWriter<W>`
