---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/storage/flydrive/classes/FlydriveSpoolReader.md
description: 'Reads a flydrive-backed file as a {@link @nhtio/adk!SpoolReader}.'
---

# Class: FlydriveSpoolReader

Defined in: [batteries/storage/flydrive/index.ts:98](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/storage/flydrive/index.ts#L98)

Reads a flydrive-backed file as a [@nhtio/adk!SpoolReader](../../../../spooled_artifact/interfaces/SpoolReader.md).

## Remarks

Constructor is **not** async — but the first method call awaits a private readiness promise
that fetches the object's metadata (and in eager mode, its contents). Subsequent calls reuse
the cached state. This keeps construction call sites synchronous while still doing real I/O
lazily.

Implementations of [@nhtio/adk!SpoolReader.line](../../../../spooled_artifact/interfaces/SpoolReader.md#line), [@nhtio/adk!SpoolReader.byteLength](../../../../spooled_artifact/interfaces/SpoolReader.md#bytelength), and
[@nhtio/adk!SpoolReader.lineCount](../../../../spooled_artifact/interfaces/SpoolReader.md#linecount) all return promises. The `SpoolReader` contract supports both
sync and async return; consumers of `SpooledArtifact` handle either.

## Implements

* [`SpoolReader`](../../../../spooled_artifact/interfaces/SpoolReader.md)

## Constructors

### Constructor

```ts
new FlydriveSpoolReader(
   disk: Disk,
   key: string,
   opts?: FlydriveSpoolReaderOptions): FlydriveSpoolReader;
```

Defined in: [batteries/storage/flydrive/index.ts:104](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/storage/flydrive/index.ts#L104)

#### Parameters

| Parameter | Type                                                                        |
| --------- | --------------------------------------------------------------------------- |
| `disk`    | `Disk`                                                                      |
| `key`     | `string`                                                                    |
| `opts`    | [`FlydriveSpoolReaderOptions`](../interfaces/FlydriveSpoolReaderOptions.md) |

#### Returns

`FlydriveSpoolReader`

## Methods

### byteLength()

```ts
byteLength(): Promise<number>;
```

Defined in: [batteries/storage/flydrive/index.ts:124](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/storage/flydrive/index.ts#L124)

Returns the total number of bytes in the underlying data.

#### Returns

`Promise`<`number`>

The byte length of the underlying data.

#### Remarks

Used for reporting and token-estimation purposes. Byte length is distinct from character
length for multi-byte encodings.

#### Implementation of

[`SpoolReader`](../../../../spooled_artifact/interfaces/SpoolReader.md).[`byteLength`](../../../../spooled_artifact/interfaces/SpoolReader.md#bytelength)

***

### line()

```ts
line(index: number): Promise<string | undefined>;
```

Defined in: [batteries/storage/flydrive/index.ts:117](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/storage/flydrive/index.ts#L117)

Returns the line at the given 0-based index, or `undefined` when out of range.

#### Parameters

| Parameter | Type     | Description         |
| --------- | -------- | ------------------- |
| `index`   | `number` | 0-based line index. |

#### Returns

`Promise`<`string` | `undefined`>

The raw line string (without trailing newline), or `undefined`.

#### Implementation of

[`SpoolReader`](../../../../spooled_artifact/interfaces/SpoolReader.md).[`line`](../../../../spooled_artifact/interfaces/SpoolReader.md#line)

***

### lineCount()

```ts
lineCount(): Promise<number>;
```

Defined in: [batteries/storage/flydrive/index.ts:129](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/storage/flydrive/index.ts#L129)

Returns the total number of lines in the underlying data.

#### Returns

`Promise`<`number`>

The total line count.

#### Remarks

Required so consumers know when to stop iterating; the line count must remain stable for the
lifetime of the reader.

#### Implementation of

[`SpoolReader`](../../../../spooled_artifact/interfaces/SpoolReader.md).[`lineCount`](../../../../spooled_artifact/interfaces/SpoolReader.md#linecount)

***

### readAll()

```ts
readAll(): Promise<string>;
```

Defined in: [batteries/storage/flydrive/index.ts:143](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/storage/flydrive/index.ts#L143)

Returns the full underlying content as a single decoded string, byte-faithful to the source.

#### Returns

`Promise`<`string`>

#### Remarks

In **eager mode** the content is already cached at construction-time load and this method is
effectively a property access. In **streaming mode** there is no cache: the file is
re-streamed and concatenated on every call. Use [@nhtio/adk!SpooledArtifact.asString](../../../../spooled_artifact/classes/SpooledArtifact.md#asstring) judiciously
on large streaming-mode artifacts.

#### Implementation of

[`SpoolReader`](../../../../spooled_artifact/interfaces/SpoolReader.md).[`readAll`](../../../../spooled_artifact/interfaces/SpoolReader.md#readall)
