コンテンツにスキップ

@alneas/universal-storage API リファレンス

@alneas/universal-storage API リファレンス

Section titled “@alneas/universal-storage API リファレンス”

【未翻訳】Computes SHA-256 hex string synchronously.

export function sha256Hex(data: Uint8Array | ArrayBuffer | string): string
引数 型 必須 説明
data `string ArrayBuffer Uint8Array`
  • Type: string

【未翻訳】Computes pure SHA-256 digest synchronously.

export function sha256Bytes(data: Uint8Array | ArrayBuffer | string): Uint8Array
引数 型 必須 説明
data `string ArrayBuffer Uint8Array`
  • Type: Uint8Array<ArrayBufferLike>

【未翻訳】Computes pure HMAC-SHA256 signature synchronously.

export function hmacSha256(
key: Uint8Array | ArrayBuffer | string,
data: Uint8Array | ArrayBuffer | string,
): Uint8Array
引数 型 必須 説明
key `string ArrayBuffer Uint8Array`
data `string ArrayBuffer Uint8Array`
  • Type: Uint8Array<ArrayBufferLike>

【未翻訳】Computes HMAC-SHA256 signature returning hex string synchronously.

export function hmacSha256Hex(
key: Uint8Array | ArrayBuffer | string,
data: Uint8Array | ArrayBuffer | string,
): string
引数 型 必須 説明
key `string ArrayBuffer Uint8Array`
data `string ArrayBuffer Uint8Array`
  • Type: string

【未翻訳】Encodes a UTF-8 string to base64 using Web standards (works in Browser, Workers, Node).

export function base64EncodeUtf8(str: string): string
引数 型 必須 説明
str string 必須
  • Type: string

【未翻訳】Decodes a base64 string to a UTF-8 string using Web standards.

export function base64DecodeUtf8(base64: string): string
引数 型 必須 説明
base64 string 必須
  • Type: string

【未翻訳】Common runtime client for S3, R2, and OCI. Always uses standard fetch + SigV4. Installing an unrelated SDK never changes behavior.

class S3CompatibleRuntime

【未翻訳】Generate a signed download URL without an SDK.

export function presignS3GetUrl(config: S3RuntimeConfig, key: string, options?: StorageURLOptions): string
引数 型 必須 説明
config S3RuntimeConfig 必須
key string 必須
options `StorageURLOptions undefined` 任意
  • Type: string

【未翻訳】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
引数 型 必須 説明
config S3RuntimeConfig 必須
key string 必須
options `Pick<StorageURLOptions, “expiresIn”> undefined` 任意
  • Type: string

【未翻訳】Interface S3RuntimeConfig

interface S3RuntimeConfig

【未翻訳】Interface S3PutInput

interface S3PutInput

【未翻訳】Storage adapter for AWS S3.

Supports Object Lock (WORM) for original document retention under compliance requirements.

  • Object Lock (Compliance/Governance) support
  • Automatic SHA-256 hash calculation and metadata storage
  • Signed URL generation
  • Tag-based metadata storage
class S3StorageAdapter
```typescript
const 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 Lock
await storage.upload('invoices/inv-001.pdf', pdfBuffer);
// Generate signed URL
const url = await storage.getUrl('invoices/inv-001.pdf', { expiresIn: 3600 });
---