@alneas/universal-storage API リファレンス
@alneas/universal-storage API リファレンス
Section titled “@alneas/universal-storage API リファレンス”FUNCTION sha256Hex
Section titled “FUNCTION sha256Hex”【未翻訳】Computes SHA-256 hex string synchronously.
export function sha256Hex(data: Uint8Array | ArrayBuffer | string): string引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
data |
`string | ArrayBuffer | Uint8Array |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
string
FUNCTION sha256Bytes
Section titled “FUNCTION sha256Bytes”【未翻訳】Computes pure SHA-256 digest synchronously.
export function sha256Bytes(data: Uint8Array | ArrayBuffer | string): Uint8Array引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
data |
`string | ArrayBuffer | Uint8Array |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
Uint8Array<ArrayBufferLike>
FUNCTION hmacSha256
Section titled “FUNCTION hmacSha256”【未翻訳】Computes pure HMAC-SHA256 signature synchronously.
export function hmacSha256( key: Uint8Array | ArrayBuffer | string, data: Uint8Array | ArrayBuffer | string,): Uint8Array引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
key |
`string | ArrayBuffer | Uint8Array |
data |
`string | ArrayBuffer | Uint8Array |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
Uint8Array<ArrayBufferLike>
FUNCTION hmacSha256Hex
Section titled “FUNCTION hmacSha256Hex”【未翻訳】Computes HMAC-SHA256 signature returning hex string synchronously.
export function hmacSha256Hex( key: Uint8Array | ArrayBuffer | string, data: Uint8Array | ArrayBuffer | string,): string引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
key |
`string | ArrayBuffer | Uint8Array |
data |
`string | ArrayBuffer | Uint8Array |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
string
FUNCTION base64EncodeUtf8
Section titled “FUNCTION base64EncodeUtf8”【未翻訳】Encodes a UTF-8 string to base64 using Web standards (works in Browser, Workers, Node).
export function base64EncodeUtf8(str: string): string引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
str |
string |
必須 |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
string
FUNCTION base64DecodeUtf8
Section titled “FUNCTION base64DecodeUtf8”【未翻訳】Decodes a base64 string to a UTF-8 string using Web standards.
export function base64DecodeUtf8(base64: string): string引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
base64 |
string |
必須 |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
string
CLASS S3CompatibleRuntime
Section titled “CLASS S3CompatibleRuntime”【未翻訳】Common runtime client for S3, R2, and OCI. Always uses standard fetch + SigV4. Installing an unrelated SDK never changes behavior.
class S3CompatibleRuntimeFUNCTION presignS3GetUrl
Section titled “FUNCTION presignS3GetUrl”【未翻訳】Generate a signed download URL without an SDK.
export function presignS3GetUrl(config: S3RuntimeConfig, key: string, options?: StorageURLOptions): string引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
config |
S3RuntimeConfig |
必須 | |
key |
string |
必須 | |
options |
`StorageURLOptions | undefined` | 任意 |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
string
FUNCTION presignS3PutUrl
Section titled “FUNCTION presignS3PutUrl”【未翻訳】Generate a signed PUT URL. Upload the bytes with HTTP PUT to this exact URL.
export function presignS3PutUrl(config: S3RuntimeConfig, key: string, options?: Pick<StorageURLOptions, 'expiresIn'>): string引数 (Parameters)
Section titled “引数 (Parameters)”| 引数 | 型 | 必須 | 説明 |
|---|---|---|---|
config |
S3RuntimeConfig |
必須 | |
key |
string |
必須 | |
options |
`Pick<StorageURLOptions, “expiresIn”> | undefined` | 任意 |
戻り値 (Returns)
Section titled “戻り値 (Returns)”- Type:
string
INTERFACE S3RuntimeConfig
Section titled “INTERFACE S3RuntimeConfig”【未翻訳】Interface S3RuntimeConfig
interface S3RuntimeConfigINTERFACE S3PutInput
Section titled “INTERFACE S3PutInput”【未翻訳】Interface S3PutInput
interface S3PutInputCLASS S3StorageAdapter
Section titled “CLASS S3StorageAdapter”【未翻訳】Storage adapter for AWS S3.
Supports Object Lock (WORM) for original document retention under compliance requirements.
Features
Section titled “Features”- Object Lock (Compliance/Governance) support
- Automatic SHA-256 hash calculation and metadata storage
- Signed URL generation
- Tag-based metadata storage
class S3StorageAdapter使用例 (Example)
Section titled “使用例 (Example)”```typescriptconst storage = new S3StorageAdapter({ region: 'ap-northeast-1', bucket: 'my-compliance-bucket', accessKeyId: process.env.AWS_ACCESS_KEY_ID!, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!, objectLockEnabled: true, defaultRetentionDays: 2555, // 7 years});
// Upload with Object Lockawait storage.upload('invoices/inv-001.pdf', pdfBuffer);
// Generate signed URLconst url = await storage.getUrl('invoices/inv-001.pdf', { expiresIn: 3600 });---