Types โ
All shared types are exported from sobj/types.
๐ฅ Import โ
ts
import type {
SobjBody,
SobjObject,
SobjMetadata,
SobjList,
SobjRange,
GetOptions,
PutOptions,
ListOptions,
CopyOptions,
PresignOptions,
PresignPutOptions,
MultipartUpload,
MultipartPart,
CreateMultipartOptions,
ListVersionsOptions,
SobjVersion,
SobjVersions,
} from 'sobj/types'๐ชน SobjBody โ
Accepted body types for uploads.
ts
type SobjBody =
| string
| Uint8Array
| ArrayBuffer
| Blob
| ReadableStream<Uint8Array>๐ฆ SobjObject โ
Represents a downloaded object.
ts
interface SobjObject {
readonly body: ReadableStream<Uint8Array>
readonly metadata: SobjMetadata
}๐ SobjMetadata โ
Metadata associated with a stored object.
ts
interface SobjMetadata {
readonly cacheControl?: string
readonly contentDisposition?: string
readonly contentEncoding?: string
readonly contentLanguage?: string
readonly contentType?: string
readonly etag?: string
readonly key: string
readonly lastModified?: Date
readonly metadata?: Readonly<Record<string, string>>
readonly size?: number
}| Property | Type | Description |
|---|---|---|
key | string | Object key |
size | number | Size in bytes |
etag | string | ETag / content hash |
contentType | string | MIME type |
lastModified | Date | Last-modified timestamp |
metadata | Record<string, string> | Custom user-defined metadata |
cacheControl | string | Cache-Control header value |
contentDisposition | string | Content-Disposition header value |
contentEncoding | string | Content-Encoding header value |
contentLanguage | string | Content-Language header value |
๐ SobjRange โ
A byte range for partial downloads.
ts
interface SobjRange {
readonly start?: number
readonly end?: number
}๐ SobjList โ
Result of a list operation.
ts
interface SobjList {
readonly cursor?: string
readonly hasMore: boolean
readonly objects: readonly SobjMetadata[]
readonly prefixes: readonly string[]
}| Property | Type | Description |
|---|---|---|
objects | SobjMetadata[] | Objects in this page |
prefixes | string[] | Common prefixes (virtual directories) when using a delimiter |
hasMore | boolean | Whether more results are available |
cursor | string | Cursor to pass to the next list call |
โ๏ธ GetOptions โ
Options for get.
ts
interface GetOptions {
readonly ifMatch?: string
readonly ifModifiedSince?: Date
readonly ifNoneMatch?: string
readonly ifUnmodifiedSince?: Date
readonly range?: SobjRange
}โ๏ธ PutOptions โ
Options for put.
ts
interface PutOptions {
readonly cacheControl?: string
readonly contentDisposition?: string
readonly contentEncoding?: string
readonly contentLanguage?: string
readonly contentType?: string
readonly ifMatch?: string
readonly ifNoneMatch?: string
readonly metadata?: Readonly<Record<string, string>>
}โ๏ธ ListOptions โ
Options for list.
ts
interface ListOptions {
readonly cursor?: string
readonly delimiter?: string
readonly limit?: number
readonly prefix?: string
}โ๏ธ CopyOptions โ
Options for copy.
ts
interface CopyOptions {
readonly cacheControl?: string
readonly contentType?: string
readonly metadata?: Readonly<Record<string, string>>
readonly overwrite?: boolean
}Set overwrite: false to fail if the destination already exists.
โ๏ธ PresignOptions โ
Options for presign.get.
ts
interface PresignOptions {
readonly expiresIn?: number // seconds, default: 3600
}โ๏ธ PresignPutOptions โ
Options for presign.put.
ts
interface PresignPutOptions extends PresignOptions {
readonly contentLength?: number
readonly contentType?: string
}๐ฆ MultipartUpload โ
Represents an in-progress multipart upload.
ts
interface MultipartUpload {
readonly id: string
readonly key: string
}๐ฆ MultipartPart โ
Represents a completed part of a multipart upload.
ts
interface MultipartPart {
readonly etag: string
readonly partNumber: number
}๐ฆ CreateMultipartOptions โ
Options for multipart.create. Extends PutOptions.
ts
interface CreateMultipartOptions extends PutOptions {}๐ท๏ธ SobjVersion โ
Represents a specific version of an object.
ts
interface SobjVersion {
readonly isDeleteMarker?: boolean
readonly isLatest: boolean
readonly metadata: SobjMetadata
readonly version: string
}๐ท๏ธ SobjVersions โ
Result of versioning.list.
ts
interface SobjVersions {
readonly cursor?: string
readonly hasMore: boolean
readonly versions: readonly SobjVersion[]
}โ๏ธ ListVersionsOptions โ
Options for versioning.list.
ts
interface ListVersionsOptions {
readonly cursor?: string
readonly limit?: number
}๐ Related โ
- Operations โ how these types are used
- Errors โ error types