> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: BijectionStorageReader

> Reference for the BijectionStorageReader interface in bijection/server.

[server](/api/modules/server).BijectionStorageReader

## Hierarchy

* [`StorageReader`](/api/interfaces/server.StorageReader)

  ↳ **`BijectionStorageReader`**

  ↳↳ [`BijectionStorageWriter`](/api/interfaces/server.BijectionStorageWriter)

## Methods

### inspectProtectedFile

▸ **inspectProtectedFile**(`storageId`): `Promise`\<[`ProtectedFileBinding`](/api/interfaces/server.ProtectedFileBinding)>

Inspect a protected file's logical lifecycle in this transaction. The
native row and current source permissions are read dependencies, so an
erasure racing this transaction refuses its result or commit. Missing,
ordinary, erased, and unauthorized files do not disclose metadata.
This does not verify that physical blob bytes still exist.

#### Parameters

| Name | Type |
| :- | :- |
| `storageId` | [`GenericId`](/api/modules/values#genericid)\<`"_storage"`> |

#### Returns

`Promise`\<[`ProtectedFileBinding`](/api/interfaces/server.ProtectedFileBinding)>

***

### getUrl

▸ **getUrl**(`storageId`): `Promise`\<`null` | `string`>

Get the URL for a file in storage by its `Id<"_storage">`.

The GET response includes a standard HTTP Digest header with a sha256 checksum.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const url = await ctx.storage.getUrl(storageId);
```

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `storageId` | [`GenericId`](/api/modules/values#genericid)\<`"_storage"`> | The `Id<"_storage">` of the file to fetch from Bijection storage. |

#### Returns

`Promise`\<`null` | `string`>

* A URL which fetches the file via an HTTP GET, or `null` if the file no longer exists.

#### Inherited from

[StorageReader](/api/interfaces/server.StorageReader).[getUrl](/api/interfaces/server.StorageReader#geturl)

▸ **getUrl**\<`T`>(`storageId`): `Promise`\<`null` | `string`>

**`Deprecated`**

Passing a string is deprecated, use `storage.getUrl(Id<"_storage">)` instead.

Get the URL for a file in storage by its [StorageId](/api/modules/server#storageid).

The GET response includes a standard HTTP Digest header with a sha256 checksum.

#### Type parameters

| Name | Type |
| :- | :- |
| `T` | extends `string` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `storageId` | `T` extends \{ `__tableName`: `any`  } ? `never` : `T` | The [StorageId](/api/modules/server#storageid) of the file to fetch from Bijection storage. |

#### Returns

`Promise`\<`null` | `string`>

* A url which fetches the file via an HTTP GET, or `null` if it no longer exists.

#### Inherited from

[StorageReader](/api/interfaces/server.StorageReader).[getUrl](/api/interfaces/server.StorageReader#geturl)

***

### getMetadata

▸ **getMetadata**(`storageId`): `Promise`\<`null` | [`FileMetadata`](/api/modules/server#filemetadata)>

**`Deprecated`**

Use `ctx.db.system.get("_storage", storageId)` instead, which returns
equivalent metadata from the `_storage` system table (with a slightly different shape):

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const metadata = await ctx.db.system.get("_storage", storageId);
// { _id, _creationTime, sha256, size, contentType? }
```

Get metadata for a file.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `storageId` | [`GenericId`](/api/modules/values#genericid)\<`"_storage"`> | The `Id<"_storage">` of the file. |

#### Returns

`Promise`\<`null` | [`FileMetadata`](/api/modules/server#filemetadata)>

* A [FileMetadata](/api/modules/server#filemetadata) object if found or `null` if not found.

#### Inherited from

[StorageReader](/api/interfaces/server.StorageReader).[getMetadata](/api/interfaces/server.StorageReader#getmetadata)

▸ **getMetadata**\<`T`>(`storageId`): `Promise`\<`null` | [`FileMetadata`](/api/modules/server#filemetadata)>

**`Deprecated`**

Use `ctx.db.system.get("_storage", storageId)` instead.

Get metadata for a file.

#### Type parameters

| Name | Type |
| :- | :- |
| `T` | extends `string` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `storageId` | `T` extends \{ `__tableName`: `any`  } ? `never` : `T` | The [StorageId](/api/modules/server#storageid) of the file. |

#### Returns

`Promise`\<`null` | [`FileMetadata`](/api/modules/server#filemetadata)>

* A [FileMetadata](/api/modules/server#filemetadata) object if found or `null` if not found.

#### Inherited from

[StorageReader](/api/interfaces/server.StorageReader).[getMetadata](/api/interfaces/server.StorageReader#getmetadata)
