abstract class
Bakelite::Item
- Bakelite::Item
- Reference
- Object
Overview
Abstract representation of an embedded or stored virtual file.
Direct Known Subclasses
Defined in:
bakelite/item.crConstructors
Class Method Summary
-
.normalize_sha256(digest : String) : String
Normalizes a SHA-256 hex digest string (strips optional "sha256:" prefix and downcases).
Instance Method Summary
- #compressed_size : Int64
-
#compute_crc32 : UInt32
Recomputes the CRC32 checksum by streaming the uncompressed content.
-
#compute_sha256 : String
Recomputes the lowercase hex SHA-256 digest by streaming the uncompressed content.
-
#content : String
Alias for to_s for instant content inspection.
-
#content_address : String
Returns the canonical deterministic content address URI ("sha256:
"). - #crc32 : UInt32
-
#crc32_hex : String
Hexadecimal formatted CRC32 checksum (e.g.
-
#etag : String
HTTP-compliant ETag string based on CRC32 checksum and file size.
-
#extract(target_path : Path | String, overwrite : Bool = true) : Bool
Extracts this virtual file to a target path on disk.
- #mime_type : String
-
#open : IO
Opens a readable stream for this asset.
-
#open(&block : IO -> T) : T forall T
Yields an open stream to the block and automatically closes it upon completion.
- #path : String
-
#sha256 : String
Returns the deterministic 64-character lowercase hex SHA-256 digest of the uncompressed content.
-
#sha256_bytes : Bytes
Returns the 32-byte binary SHA-256 digest of the uncompressed content.
- #size : Int64
- #storage_mode : StorageMode
-
#strong_etag : String
Content-addressed strong HTTP ETag based on SHA-256 digest.
-
#to_s(io : IO) : Nil
Streams the content into the given output IO.
-
#to_s : String
Returns the content as a UTF-8 String.
-
#to_slice : Bytes
Returns the full contents as a byte slice.
-
#verify_crc32? : Bool
Verifies that the freshly streamed CRC32 checksum matches the recorded metadata crc32.
-
#verify_sha256?(expected_digest : String) : Bool
Verifies that the freshly streamed SHA-256 digest matches the expected digest.
- #volume_name : String
Constructor Detail
Class Method Detail
Normalizes a SHA-256 hex digest string (strips optional "sha256:" prefix and downcases).
Instance Method Detail
Recomputes the lowercase hex SHA-256 digest by streaming the uncompressed content.
Extracts this virtual file to a target path on disk.
Yields an open stream to the block and automatically closes it upon completion.
Returns the deterministic 64-character lowercase hex SHA-256 digest of the uncompressed content. Lazily computed and cached on first access in O(chunk_size) streaming memory.
Verifies that the freshly streamed CRC32 checksum matches the recorded metadata crc32.
Verifies that the freshly streamed SHA-256 digest matches the expected digest.