Objektumtároló-integráció
Gyakorlati adapter mögé rejti a tárolószolgáltatói eltérést a streamelés, aláírás és böngészős feltöltés igényeinek megtartásával.
object-storage-integration
Ezt a skillt használó csapattagok
Mikor hasznos?
Akkor használd, ha felhős vagy helyi objektumtárat kötsz be az SDK részleteinek alkalmazásszintű szétszórása nélkül.
Miben segít neked?
- Meghatározza a stream-, metaadat-, aláírás- és másolási adapterműveleteket.
- Szolgáltatóspecifikus működést ellenőriz feltételezett S3-azonosság helyett.
- Pontos böngészőeredetet és elérhető multipart ETag fejlécet állít be.
Például ezt kérheted
Integrálj privát R2-feltöltést ellenőrzőösszeggel és böngészős többrészes befejezéssel. Böngészőből több részt tölts fel, fejezd be, és ellenőrizd a lenyomatot. Tiltott origint és lejárt aláírást is próbálj, nyilvánossá tétel nélkül.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Object Storage Integration
While AWS S3, Cloudflare R2, MinIO, Backblaze B2, DigitalOcean Spaces, Google Cloud Storage, Azure Blob Storage and local disk all store byte blobs by key, their consistency guarantees, presigned URL capabilities, CORS rules, checksum headers and metadata limits differ. Hide vendor mechanics behind a narrow storage port while respecting provider-specific constraints.
1. Designing the Storage Adapter Boundary
Define a clean internal interface for storage operations without leaking SDK types into business services:
putStream(key, readableStream, { contentType, contentLength, sha256, metadata })getStream(key, { range }) -> { stream, contentLength, contentType, etag }head(key) -> { exists, sizeBytes, contentType, etag, checksum, lastModified }createPresignedUpload(key, { contentType, contentLengthRange, expiresInSeconds, checksumSha256 })createPresignedDownload(key, { expiresInSeconds, responseContentDisposition, responseContentType })delete(key)(idempotent — succeeds when object is already absent)copy(sourceKey, destKey)
2. Provider-Specific Capabilities & Gotchas
- AWS S3:
- Block Public Access (
BlockPublicAcls,IgnorePublicAcls,BlockPublicPolicy,RestrictPublicBuckets) must be enabled on private buckets. - Supports both presigned
PUT(exact headers bound into signature) and presignedPOST(supports["content-length-range", min, max]policy conditions!).
- Block Public Access (
- Cloudflare R2 / MinIO / S3-Compatible Stores:
- Verify whether
createPresignedPostis supported by the target provider (some S3-compatible providers only support presignedPUT+Content-Lengthbinding). - Set
region: 'auto'(for R2) orforcePathStyle: true(for local MinIO / custom endpoints) in@aws-sdk/client-s3.
- Verify whether
- Azure Blob Storage:
- Uses Block Blobs (
StageBlock->CommitBlockListfor chunked uploads) and SAS (Shared Access Signature) tokens (BlobSASPermissions:r,w,c,dscoped to exact blob path, start/expiry time andhttpsprotocol).
- Uses Block Blobs (
- Local Filesystem (Development / Self-Hosted Single-Node):
- Write uploads to a temporary file on the same filesystem mount as the target directory, then
fs.rename()atomically into place once the stream and checksum succeed so readers never observe a half-written file. - Shard directories by prefix (
blobs/ab/cd/abcdef...) so a single folder never accumulates millions of inodes.
- Write uploads to a temporary file on the same filesystem mount as the target directory, then
3. Browser CORS & Checksum Headers
Direct browser-to-object-store uploads fail silently if bucket CORS is misconfigured:
- Allow only the application's exact origins (
AllowedOrigins), methods (PUT,POST,GET,HEAD), and required headers (Content-Type,Content-MD5,x-amz-checksum-sha256,x-ms-blob-type). - Expose
ETaginExposeHeaders(Access-Control-Allow-Headers/Access-Control-Expose-Headers: ETag) — without it, browser JavaScript cannot read theETagresponse header required to complete S3 Multipart uploads!
Csomagban lévő fájlok 1
SKILL.md
