# ReadStream

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/io/read/file-system.ts#L5

Abstract base class for streaming data from a source.
Uses a pull-based model where the consumer provides the buffer.

## Constructors

### constructor

```ts
new ReadStream(expectedSize?: number)
```

**Parameters**

- `expectedSize` (`number`, optional): Optional size hint for buffer pre-allocation

## Properties

### bytesRead

```ts
bytesRead: number = 0
```

Total bytes read from this stream so far.

### expectedSize

```ts
readonly expectedSize: number
```

Size hint for buffer pre-allocation in readAll().
May be undefined if size is unknown.

## Methods

### close

```ts
close(): void
```

Release resources and abort any pending operations.

### pull

```ts
abstract pull(target: Uint8Array): Promise<number>
```

Pull data into the provided buffer.

**Parameters**

- `target` (`Uint8Array`): Buffer to fill with data

**Returns** `Promise<number>`: Number of bytes read, or 0 for EOF

### readAll

```ts
readAll(): Promise<Uint8Array<ArrayBufferLike>>
```

Read entire stream into a single buffer.
Uses expectedSize hint if available, grows dynamically if needed.

**Returns** `Promise<Uint8Array<ArrayBufferLike>>`: Complete data as Uint8Array
