@btravstack/storage / index
index
Classes
ChecksumMismatch
Defined in: packages/storage/src/storage.ts:39
The supplied SHA-256 did not match the body; no object was written.
Extends
TaggedErrorInstance<"ChecksumMismatch", {key:string; }>
Constructors
Constructor
new ChecksumMismatch(args): ChecksumMismatch;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("ChecksumMismatch")<{ readonly key: string; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "ChecksumMismatch" | TaggedError("ChecksumMismatch")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause? | public | unknown | TaggedError("ChecksumMismatch").cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("ChecksumMismatch").key | packages/storage/src/storage.ts:40 |
message | public | string | TaggedError("ChecksumMismatch").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("ChecksumMismatch").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("ChecksumMismatch").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
InvalidStorageOptions
Defined in: packages/storage/src/storage.ts:33
Invalid options are refused before any write or signature is attempted.
Extends
TaggedErrorInstance<"InvalidStorageOptions", {key:string;reason:"invalid_sha256"|"invalid_metadata_key"; }>
Constructors
Constructor
new InvalidStorageOptions(args): InvalidStorageOptions;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("InvalidStorageOptions")<{ readonly key: string; readonly reason: "invalid_sha256" | "invalid_metadata_key"; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "InvalidStorageOptions" | TaggedError("InvalidStorageOptions")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause? | public | unknown | TaggedError("InvalidStorageOptions").cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("InvalidStorageOptions").key | packages/storage/src/storage.ts:34 |
message | public | string | TaggedError("InvalidStorageOptions").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("InvalidStorageOptions").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
reason | readonly | "invalid_sha256" | "invalid_metadata_key" | TaggedError("InvalidStorageOptions").reason | packages/storage/src/storage.ts:35 |
stack? | public | string | TaggedError("InvalidStorageOptions").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ObjectExists
Defined in: packages/storage/src/storage.ts:28
An object already holds the key. Only putIfAbsent and putStreamIfAbsent answer it.
Extends
TaggedErrorInstance<"ObjectExists", {key:string; }>
Constructors
Constructor
new ObjectExists(args): ObjectExists;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("ObjectExists")<{ readonly key: string; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "ObjectExists" | TaggedError("ObjectExists")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause? | public | unknown | TaggedError("ObjectExists").cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("ObjectExists").key | packages/storage/src/storage.ts:29 |
message | public | string | TaggedError("ObjectExists").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("ObjectExists").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("ObjectExists").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ObjectNotFound
Defined in: packages/storage/src/storage.ts:23
The key is not there. Only get, getStream, head and copy (its source) answer it — see delete and presignedUrl below.
Extends
TaggedErrorInstance<"ObjectNotFound", {key:string; }>
Constructors
Constructor
new ObjectNotFound(args): ObjectNotFound;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("ObjectNotFound")<{ readonly key: string; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "ObjectNotFound" | TaggedError("ObjectNotFound")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause? | public | unknown | TaggedError("ObjectNotFound").cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("ObjectNotFound").key | packages/storage/src/storage.ts:24 |
message | public | string | TaggedError("ObjectNotFound").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("ObjectNotFound").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("ObjectNotFound").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
PresignNotSupported
Defined in: packages/storage/src/storage.ts:80
The adapter cannot mint a time-limited URL, and says so rather than pretending.
Extends
TaggedErrorInstance<"PresignNotSupported", {key:string; }>
Constructors
Constructor
new PresignNotSupported(args): PresignNotSupported;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("PresignNotSupported")<{ readonly key: string; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "PresignNotSupported" | TaggedError("PresignNotSupported")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause? | public | unknown | TaggedError("PresignNotSupported").cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("PresignNotSupported").key | packages/storage/src/storage.ts:81 |
message | public | string | TaggedError("PresignNotSupported").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("PresignNotSupported").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("PresignNotSupported").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
Storage
Defined in: packages/storage/src/storage.ts:270
The port an application depends on.
Keys are plain strings the caller composes, tenant included: a store is an application service, and the framework has no concept of a tenant to put in a slot.
Bytes, and streams beside them. put and get hold a document whole; putStream, putStreamIfAbsent and getStream move a large object through the process in bounded memory.
Extends
PortInstance<"Storage",StorageService>
Constructors
Constructor
new Storage(): Storage;Defined in: packages/di/dist/index.d.mts:15
Returns
Inherited from
Port("Storage")<StorageService>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
[ID] | readonly | "Storage" | Port("Storage").[ID] | packages/di/dist/index.d.mts:11 |
[SERVICE] | readonly | StorageService | Port("Storage").[SERVICE] | packages/di/dist/index.d.mts:12 |
portId | static readonly | "Storage" | Port("Storage").portId | packages/di/dist/index.d.mts:16 |
StorageBackend
Defined in: packages/storage/src/storage.ts:273
The port every adapter provides, and the one an application never depends on.
Extends
PortInstance<"StorageBackend",StorageService>
Constructors
Constructor
new StorageBackend(): StorageBackend;Defined in: packages/di/dist/index.d.mts:15
Returns
Inherited from
Port("StorageBackend")<StorageService>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
[ID] | readonly | "StorageBackend" | Port("StorageBackend").[ID] | packages/di/dist/index.d.mts:11 |
[SERVICE] | readonly | StorageService | Port("StorageBackend").[SERVICE] | packages/di/dist/index.d.mts:12 |
portId | static readonly | "StorageBackend" | Port("StorageBackend").portId | packages/di/dist/index.d.mts:16 |
StorageUnavailable
Defined in: packages/storage/src/storage.ts:62
The store could not answer — the endpoint is down, the credentials were refused, the bucket is gone.
Extends
TaggedErrorInstance<"StorageUnavailable", {key:string;operation: |"put"|"putIfAbsent"|"putStream"|"putStreamIfAbsent"|"get"|"getStream"|"copy"|"head"|"delete"|"presignedUrl"|"presignedUpload";reason:string; }>
Constructors
Constructor
new StorageUnavailable(args): StorageUnavailable;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("StorageUnavailable")<{ readonly operation: | "put" | "putIfAbsent" | "putStream" | "putStreamIfAbsent" | "get" | "getStream" | "copy" | "head" | "delete" | "presignedUrl" | "presignedUpload"; readonly key: string; readonly reason: string; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "StorageUnavailable" | TaggedError("StorageUnavailable")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause? | public | unknown | TaggedError("StorageUnavailable").cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("StorageUnavailable").key | packages/storage/src/storage.ts:75 |
message | public | string | TaggedError("StorageUnavailable").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("StorageUnavailable").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
operation | readonly | | "put" | "putIfAbsent" | "putStream" | "putStreamIfAbsent" | "get" | "getStream" | "copy" | "head" | "delete" | "presignedUrl" | "presignedUpload" | TaggedError("StorageUnavailable").operation | packages/storage/src/storage.ts:63 |
reason | readonly | string | TaggedError("StorageUnavailable").reason | packages/storage/src/storage.ts:76 |
stack? | public | string | TaggedError("StorageUnavailable").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
StreamInterrupted
Defined in: packages/storage/src/storage.ts:44
The source stream errored before it ended, with cause; no object was written.
Extends
TaggedErrorInstance<"StreamInterrupted", {cause:unknown;key:string; }>
Constructors
Constructor
new StreamInterrupted(args): StreamInterrupted;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("StreamInterrupted")<{ readonly key: string; readonly cause: unknown; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "StreamInterrupted" | TaggedError("StreamInterrupted")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause | public | unknown | ChecksumMismatch.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("StreamInterrupted").key | packages/storage/src/storage.ts:45 |
message | public | string | TaggedError("StreamInterrupted").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("StreamInterrupted").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("StreamInterrupted").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
StreamPoolFull
Defined in: packages/storage/src/storage.ts:55
Every slot of the stream pool was held by another transfer, so this one was refused before anything was sent; a write's stream is cancelled. Only getStream, putStream and putStreamIfAbsent answer it. Shedding the load (a 503 with Retry-After) is the caller's to decide.
Extends
TaggedErrorInstance<"StreamPoolFull", {key:string;maxSockets:number;operation:"putStream"|"putStreamIfAbsent"|"getStream"; }>
Constructors
Constructor
new StreamPoolFull(args): StreamPoolFull;Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386
Parameters
| Parameter | Type |
|---|---|
args | object & object |
Returns
Inherited from
TaggedError("StreamPoolFull")<{ readonly operation: "getStream" | "putStream" | "putStreamIfAbsent"; readonly key: string; readonly maxSockets: number; }>.constructor
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "StreamPoolFull" | TaggedError("StreamPoolFull")._tag | node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363 |
cause? | public | unknown | TaggedError("StreamPoolFull").cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
key | readonly | string | TaggedError("StreamPoolFull").key | packages/storage/src/storage.ts:57 |
maxSockets | readonly | number | TaggedError("StreamPoolFull").maxSockets | packages/storage/src/storage.ts:58 |
message | public | string | TaggedError("StreamPoolFull").message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("StreamPoolFull").name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
operation | readonly | "putStream" | "putStreamIfAbsent" | "getStream" | TaggedError("StreamPoolFull").operation | packages/storage/src/storage.ts:56 |
stack? | public | string | TaggedError("StreamPoolFull").stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
Type Aliases
CopyOptions
type CopyOptions = object;Defined in: packages/storage/src/storage.ts:109
A destination description and optional server-computed checksum; no write digest is accepted.
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
checksum? | readonly | "sha256" | packages/storage/src/storage.ts:113 |
contentType | readonly | string | packages/storage/src/storage.ts:110 |
kmsKeyId? | readonly | string | packages/storage/src/storage.ts:111 |
metadata? | readonly | Readonly<Record<string, string>> | packages/storage/src/storage.ts:112 |
sha256? | readonly | never | packages/storage/src/storage.ts:114 |
DownloadOptions
type DownloadOptions = object;Defined in: packages/storage/src/storage.ts:118
Signed response headers for this download only; stored object metadata is unchanged.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
cacheControl? | readonly | string | - | packages/storage/src/storage.ts:123 |
contentDisposition? | readonly | string | Content-Disposition header. Encode Unicode filenames with RFC 8187 filename*. | packages/storage/src/storage.ts:121 |
contentType? | readonly | string | - | packages/storage/src/storage.ts:122 |
ttlMs | readonly | number | - | packages/storage/src/storage.ts:119 |
ObjectHead
type ObjectHead = object;Defined in: packages/storage/src/storage.ts:85
What the store knows about an object without sending its bytes.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
contentType | readonly | string | - | packages/storage/src/storage.ts:89 |
metadata | readonly | Readonly<Record<string, string>> | An owned snapshot of user metadata; empty when none was written. | packages/storage/src/storage.ts:88 |
sha256? | readonly | string | Lowercase hex of a full-object SHA-256; absent when the store holds none. Composite multipart checksums are excluded. | packages/storage/src/storage.ts:91 |
size | readonly | number | - | packages/storage/src/storage.ts:86 |
StorageOptions
type StorageOptions<E, N> = object;Defined in: packages/storage/src/module.ts:8
Type Parameters
| Type Parameter |
|---|
E |
N |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
adapter | readonly | Module<StorageBackend, E, N> | The adapter module: memoryStorage() from this entry point, s3Storage() from @btravstack/storage/s3, or one an application wrote itself over StorageBackend. | packages/storage/src/module.ts:14 |
StorageService
type StorageService = object;Defined in: packages/storage/src/storage.ts:126
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
copy | readonly | (from, to, options) => AsyncResult<void, | ObjectNotFound | InvalidStorageOptions | StorageUnavailable> | Copies from to to inside the store: no bytes pass through this process. The copy replaces metadata (empty when omitted) and contentType, and, with kmsKeyId, is encrypted with that key. An existing to is overwritten. | packages/storage/src/storage.ts:194 |
delete | readonly | (key) => AsyncResult<void, StorageUnavailable> | Deleting a key nobody stored is Ok: delete is idempotent, which is S3's own behaviour rather than a fiction over it. | packages/storage/src/storage.ts:207 |
get | readonly | (key) => AsyncResult<StoredObject, | ObjectNotFound | StorageUnavailable> | - | packages/storage/src/storage.ts:184 |
getStream | readonly | (key) => AsyncResult<StreamedObject, | ObjectNotFound | StreamPoolFull | StorageUnavailable> | The object as a stream, with its type and size, answered once the store has begun sending it. | packages/storage/src/storage.ts:186 |
head | readonly | (key) => AsyncResult<ObjectHead, | ObjectNotFound | StorageUnavailable> | Size, type and checksum of an object, without reading it. sha256 is present only if the store holds one: S3 keeps it for an object written with a SHA-256 checksum (write/presign sha256, or copy checksum), and reports it base64-encoded, which the adapter converts to hex. | packages/storage/src/storage.ts:205 |
presignedUpload | readonly | (key, options) => AsyncResult<string, | PresignNotSupported | InvalidStorageOptions | StorageUnavailable> | A URL that writes the object for ttlMs, without the caller holding credentials — so the bytes go from the client to the store and never through this process. contentType and contentLength are signed, not advisory. They are part of the signature, so a client sending different ones is refused by the store. The same URL can write the key repeatedly until expiry, replacing the previous object with different bytes of that size and type. Neither signed header proves the bytes. contentLength is required — an unsigned length would allow an unbounded single write, and there is no ceiling a presigned PUT can express other than the exact number. sha256 (lowercase hex, 64 characters) is optional. When given, the checksum header is signed too, so the store refuses any body that does not hash to it, and keeps it for head. The client must send the same value as x-amz-checksum-sha256 (base64 of the digest). With kmsKeyId, both x-amz-server-side-encryption: aws:kms and x-amz-server-side-encryption-aws-kms-key-id are mandatory signed headers. The client sends the exact key id used here. Omitting or changing either breaks the signature. Malformed sha256 returns InvalidStorageOptions. The application still decides every input: whether this caller may write this key, how long the URL lives, and what size it is willing to accept. The adapter computes a signature over that decision and nothing more. | packages/storage/src/storage.ts:247 |
presignedUrl | readonly | (key, options) => AsyncResult<string, | PresignNotSupported | StorageUnavailable> | A URL that reads the object for ttlMs, without the caller holding credentials. There is no ObjectNotFound arm: presigning is a signature computation that asks the store nothing, so a URL for an absent key is minted happily and 404s when followed. Checking would cost a HEAD per call. | packages/storage/src/storage.ts:216 |
put | readonly | (key, bytes, options) => AsyncResult<void, | InvalidStorageOptions | ChecksumMismatch | StorageUnavailable> | - | packages/storage/src/storage.ts:127 |
putIfAbsent | readonly | (key, bytes, options) => AsyncResult<void, | ObjectExists | InvalidStorageOptions | ChecksumMismatch | StorageUnavailable> | Writes the object only if no object holds the key: the first writer wins, atomically, in the store. | packages/storage/src/storage.ts:133 |
putStream | readonly | (key, stream, options) => AsyncResult<void, | InvalidStorageOptions | ChecksumMismatch | StreamInterrupted | StreamPoolFull | StorageUnavailable> | Writes the object as stream delivers it, never holding it whole: the S3 adapter sends a stream longer than one 8 MiB part as a multipart upload, one part at a time. S3's 10,000 parts cap such an object near 78 GiB; a longer stream is refused by the store, as StorageUnavailable. The object appears only once the stream has ended and every part is stored. A failure (the stream's own error, a sha256 the bytes do not match, the store) aborts the upload, so no partial object is ever visible, and cancels the stream. sha256 is verified by the adapter as the bytes pass, before the object is completed; the store keeps no digest, so head answers none. | packages/storage/src/storage.ts:153 |
putStreamIfAbsent | readonly | (key, stream, options) => AsyncResult<void, | ObjectExists | InvalidStorageOptions | ChecksumMismatch | StreamInterrupted | StreamPoolFull | StorageUnavailable> | putStream, completed only if no object holds the key: the first writer wins, atomically, in the store. The S3 adapter sends If-None-Match: * on the write that publishes the object, so a held key is refused once the stream has been sent. | packages/storage/src/storage.ts:171 |
StoredObject
type StoredObject = object;Defined in: packages/storage/src/storage.ts:5
One stored object: its bytes and what they are.
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
bytes | readonly | Uint8Array | packages/storage/src/storage.ts:6 |
contentType | readonly | string | packages/storage/src/storage.ts:7 |
StreamedObject
type StreamedObject = object;Defined in: packages/storage/src/storage.ts:15
An object read as it streams. stream holds the store's connection until it is read to its end or cancelled, so a caller that stops early cancels it. A read the store breaks off errors the stream.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
contentType | readonly | string | - | packages/storage/src/storage.ts:17 |
size | readonly | number | undefined | The object's length in bytes; undefined when the store did not say, never a guessed 0. | packages/storage/src/storage.ts:19 |
stream | readonly | ReadableStream<Uint8Array> | - | packages/storage/src/storage.ts:16 |
WriteOptions
type WriteOptions = object;Defined in: packages/storage/src/storage.ts:98
Written with kmsKeyId, an object is encrypted at rest with that KMS key (SSE-KMS); without it, the store's own default applies.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
checksum? | readonly | never | - | packages/storage/src/storage.ts:105 |
contentType | readonly | string | - | packages/storage/src/storage.ts:99 |
kmsKeyId? | readonly | string | - | packages/storage/src/storage.ts:100 |
metadata? | readonly | Readonly<Record<string, string>> | Lowercase ASCII HTTP-token keys, without x-amz-meta-. No normalization; uppercase keys (and thus case collisions) are refused. The caller respects S3's 2 KB UTF-8 key/value limit. | packages/storage/src/storage.ts:104 |
sha256? | readonly | string | Lowercase, 64-character hex. The store verifies the body before publishing it. | packages/storage/src/storage.ts:102 |
Functions
memoryStorage()
function memoryStorage(): Module<StorageBackend, never, never>;Defined in: packages/storage/src/memory.ts:149
The adapter as a module, which is the shape storage({ adapter }) takes.
Returns
Module<StorageBackend, never, never>
memoryStorageBackend()
function memoryStorageBackend(): StorageService;Defined in: packages/storage/src/memory.ts:58
The in-process adapter: a Map, and an honest refusal to presign.
presignedUrl answers PresignNotSupported rather than minting a fake URL, which would be the worst kind of double — one that passes locally and fails in the deployment for a reason no test could have shown.
kmsKeyId is accepted and ignored: nothing is encrypted at rest here.
ponytail: no size limit, so a process storing unbounded objects grows unbounded. The upgrade path is the S3 adapter.
Returns
memoryStorageProvider()
function memoryStorageProvider(): Provider<StorageBackend, never, never> & object;Defined in: packages/storage/src/memory.ts:145
The adapter as a provider, which is the shape @btravstack/testing's overridden takes.
Returns
Provider<StorageBackend, never, never> & object
storage()
function storage<E, N>(__namedParameters): Module<Storage | HealthChecks, E, N>;Defined in: packages/storage/src/module.ts:33
The storage starter: an adapter, and Storage provided from it.
storage({ adapter: s3Storage() });Two ports, because di allows one provider per port per graph: the port an application depends on must not be the one an adapter provides, which is what lets this function be the seam.
There is no instrumented flag. Every operation is handed to whatever contributed to Observers; a graph that composed no observability has only this module's own no-op member, so it costs one call per operation and nothing else.
Type Parameters
| Type Parameter |
|---|
E |
N |
Parameters
| Parameter | Type |
|---|---|
__namedParameters | StorageOptions<E, N> |
Returns
Module<Storage | HealthChecks, E, N>