Skip to content

@btravstack/storage


@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 ​
ts
new ChecksumMismatch(args): ChecksumMismatch;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

ChecksumMismatch

Inherited from ​

TaggedError("ChecksumMismatch")<{ readonly key: string; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"ChecksumMismatch"TaggedError("ChecksumMismatch")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("ChecksumMismatch").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("ChecksumMismatch").keypackages/storage/src/storage.ts:40
messagepublicstringTaggedError("ChecksumMismatch").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("ChecksumMismatch").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("ChecksumMismatch").stacknode_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 ​
ts
new InvalidStorageOptions(args): InvalidStorageOptions;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

InvalidStorageOptions

Inherited from ​

TaggedError("InvalidStorageOptions")<{ readonly key: string; readonly reason: "invalid_sha256" | "invalid_metadata_key"; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"InvalidStorageOptions"TaggedError("InvalidStorageOptions")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("InvalidStorageOptions").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("InvalidStorageOptions").keypackages/storage/src/storage.ts:34
messagepublicstringTaggedError("InvalidStorageOptions").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("InvalidStorageOptions").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
reasonreadonly"invalid_sha256" | "invalid_metadata_key"TaggedError("InvalidStorageOptions").reasonpackages/storage/src/storage.ts:35
stack?publicstringTaggedError("InvalidStorageOptions").stacknode_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 ​
ts
new ObjectExists(args): ObjectExists;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

ObjectExists

Inherited from ​

TaggedError("ObjectExists")<{ readonly key: string; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"ObjectExists"TaggedError("ObjectExists")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("ObjectExists").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("ObjectExists").keypackages/storage/src/storage.ts:29
messagepublicstringTaggedError("ObjectExists").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("ObjectExists").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("ObjectExists").stacknode_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 ​
ts
new ObjectNotFound(args): ObjectNotFound;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

ObjectNotFound

Inherited from ​

TaggedError("ObjectNotFound")<{ readonly key: string; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"ObjectNotFound"TaggedError("ObjectNotFound")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("ObjectNotFound").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("ObjectNotFound").keypackages/storage/src/storage.ts:24
messagepublicstringTaggedError("ObjectNotFound").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("ObjectNotFound").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("ObjectNotFound").stacknode_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 ​
ts
new PresignNotSupported(args): PresignNotSupported;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

PresignNotSupported

Inherited from ​

TaggedError("PresignNotSupported")<{ readonly key: string; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"PresignNotSupported"TaggedError("PresignNotSupported")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("PresignNotSupported").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("PresignNotSupported").keypackages/storage/src/storage.ts:81
messagepublicstringTaggedError("PresignNotSupported").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("PresignNotSupported").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("PresignNotSupported").stacknode_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 ​

Constructors ​

Constructor ​
ts
new Storage(): Storage;

Defined in: packages/di/dist/index.d.mts:15

Returns ​

Storage

Inherited from ​

Port("Storage")<StorageService>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
[ID]readonly"Storage"Port("Storage").[ID]packages/di/dist/index.d.mts:11
[SERVICE]readonlyStorageServicePort("Storage").[SERVICE]packages/di/dist/index.d.mts:12
portIdstatic readonly"Storage"Port("Storage").portIdpackages/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 ​

Constructors ​

Constructor ​
ts
new StorageBackend(): StorageBackend;

Defined in: packages/di/dist/index.d.mts:15

Returns ​

StorageBackend

Inherited from ​

Port("StorageBackend")<StorageService>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
[ID]readonly"StorageBackend"Port("StorageBackend").[ID]packages/di/dist/index.d.mts:11
[SERVICE]readonlyStorageServicePort("StorageBackend").[SERVICE]packages/di/dist/index.d.mts:12
portIdstatic readonly"StorageBackend"Port("StorageBackend").portIdpackages/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 ​
ts
new StorageUnavailable(args): StorageUnavailable;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

StorageUnavailable

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 ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"StorageUnavailable"TaggedError("StorageUnavailable")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("StorageUnavailable").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("StorageUnavailable").keypackages/storage/src/storage.ts:75
messagepublicstringTaggedError("StorageUnavailable").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("StorageUnavailable").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
operationreadonly| "put" | "putIfAbsent" | "putStream" | "putStreamIfAbsent" | "get" | "getStream" | "copy" | "head" | "delete" | "presignedUrl" | "presignedUpload"TaggedError("StorageUnavailable").operationpackages/storage/src/storage.ts:63
reasonreadonlystringTaggedError("StorageUnavailable").reasonpackages/storage/src/storage.ts:76
stack?publicstringTaggedError("StorageUnavailable").stacknode_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 ​
ts
new StreamInterrupted(args): StreamInterrupted;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

StreamInterrupted

Inherited from ​

TaggedError("StreamInterrupted")<{ readonly key: string; readonly cause: unknown; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"StreamInterrupted"TaggedError("StreamInterrupted")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
causepublicunknownChecksumMismatch.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("StreamInterrupted").keypackages/storage/src/storage.ts:45
messagepublicstringTaggedError("StreamInterrupted").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("StreamInterrupted").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("StreamInterrupted").stacknode_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 ​
ts
new StreamPoolFull(args): StreamPoolFull;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

StreamPoolFull

Inherited from ​

TaggedError("StreamPoolFull")<{ readonly operation: "getStream" | "putStream" | "putStreamIfAbsent"; readonly key: string; readonly maxSockets: number; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"StreamPoolFull"TaggedError("StreamPoolFull")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("StreamPoolFull").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
keyreadonlystringTaggedError("StreamPoolFull").keypackages/storage/src/storage.ts:57
maxSocketsreadonlynumberTaggedError("StreamPoolFull").maxSocketspackages/storage/src/storage.ts:58
messagepublicstringTaggedError("StreamPoolFull").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("StreamPoolFull").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
operationreadonly"putStream" | "putStreamIfAbsent" | "getStream"TaggedError("StreamPoolFull").operationpackages/storage/src/storage.ts:56
stack?publicstringTaggedError("StreamPoolFull").stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Type Aliases ​

CopyOptions ​

ts
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 ​

PropertyModifierTypeDefined in
checksum?readonly"sha256"packages/storage/src/storage.ts:113
contentTypereadonlystringpackages/storage/src/storage.ts:110
kmsKeyId?readonlystringpackages/storage/src/storage.ts:111
metadata?readonlyReadonly<Record<string, string>>packages/storage/src/storage.ts:112
sha256?readonlyneverpackages/storage/src/storage.ts:114

DownloadOptions ​

ts
type DownloadOptions = object;

Defined in: packages/storage/src/storage.ts:118

Signed response headers for this download only; stored object metadata is unchanged.

Properties ​

PropertyModifierTypeDescriptionDefined in
cacheControl?readonlystring-packages/storage/src/storage.ts:123
contentDisposition?readonlystringContent-Disposition header. Encode Unicode filenames with RFC 8187 filename*.packages/storage/src/storage.ts:121
contentType?readonlystring-packages/storage/src/storage.ts:122
ttlMsreadonlynumber-packages/storage/src/storage.ts:119

ObjectHead ​

ts
type ObjectHead = object;

Defined in: packages/storage/src/storage.ts:85

What the store knows about an object without sending its bytes.

Properties ​

PropertyModifierTypeDescriptionDefined in
contentTypereadonlystring-packages/storage/src/storage.ts:89
metadatareadonlyReadonly<Record<string, string>>An owned snapshot of user metadata; empty when none was written.packages/storage/src/storage.ts:88
sha256?readonlystringLowercase hex of a full-object SHA-256; absent when the store holds none. Composite multipart checksums are excluded.packages/storage/src/storage.ts:91
sizereadonlynumber-packages/storage/src/storage.ts:86

StorageOptions ​

ts
type StorageOptions<E, N> = object;

Defined in: packages/storage/src/module.ts:8

Type Parameters ​

Type Parameter
E
N

Properties ​

PropertyModifierTypeDescriptionDefined in
adapterreadonlyModule<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 ​

ts
type StorageService = object;

Defined in: packages/storage/src/storage.ts:126

Properties ​

PropertyModifierTypeDescriptionDefined in
copyreadonly(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
deletereadonly(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
getreadonly(key) => AsyncResult<StoredObject, | ObjectNotFound | StorageUnavailable>-packages/storage/src/storage.ts:184
getStreamreadonly(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
headreadonly(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
presignedUploadreadonly(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
presignedUrlreadonly(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
putreadonly(key, bytes, options) => AsyncResult<void, | InvalidStorageOptions | ChecksumMismatch | StorageUnavailable>-packages/storage/src/storage.ts:127
putIfAbsentreadonly(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
putStreamreadonly(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
putStreamIfAbsentreadonly(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 ​

ts
type StoredObject = object;

Defined in: packages/storage/src/storage.ts:5

One stored object: its bytes and what they are.

Properties ​

PropertyModifierTypeDefined in
bytesreadonlyUint8Arraypackages/storage/src/storage.ts:6
contentTypereadonlystringpackages/storage/src/storage.ts:7

StreamedObject ​

ts
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 ​

PropertyModifierTypeDescriptionDefined in
contentTypereadonlystring-packages/storage/src/storage.ts:17
sizereadonlynumber | undefinedThe object's length in bytes; undefined when the store did not say, never a guessed 0.packages/storage/src/storage.ts:19
streamreadonlyReadableStream<Uint8Array>-packages/storage/src/storage.ts:16

WriteOptions ​

ts
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 ​

PropertyModifierTypeDescriptionDefined in
checksum?readonlynever-packages/storage/src/storage.ts:105
contentTypereadonlystring-packages/storage/src/storage.ts:99
kmsKeyId?readonlystring-packages/storage/src/storage.ts:100
metadata?readonlyReadonly<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?readonlystringLowercase, 64-character hex. The store verifies the body before publishing it.packages/storage/src/storage.ts:102

Functions ​

memoryStorage() ​

ts
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() ​

ts
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 ​

StorageService


memoryStorageProvider() ​

ts
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() ​

ts
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.

ts
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 ​

ParameterType
__namedParametersStorageOptions<E, N>

Returns ​

Module<Storage | HealthChecks, E, N>

Released under the MIT License.