class
Bakelite::BakedItem
- Bakelite::BakedItem
- Bakelite::Item
- Reference
- Object
Overview
Directly inlined static asset (Bake mode). Holds a direct reference to static binary data in memory for instant, zero-copy reads.
Defined in:
bakelite/item.crConstructors
-
.from_string(path : String, volume_name : Symbol | String, str : String, mime_type : String | Nil = nil, crc32 : UInt32 | Nil = nil, sha256 : String | Nil = nil) : BakedItem
Fast constructor from string literal
- .new(path : String, volume_name : Symbol | String, data : Bytes, mime_type : String | Nil = nil, crc32 : UInt32 | Nil = nil, sha256 : String | Nil = nil)
Instance Method Summary
-
#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.
- #data : Bytes
-
#open : IO
Opens a readable stream for this asset.
-
#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.
Instance methods inherited from class Bakelite::Item
compressed_size : Int64
compressed_size,
compute_crc32 : UInt32
compute_crc32,
compute_sha256 : String
compute_sha256,
content : String
content,
content_address : String
content_address,
crc32 : UInt32
crc32,
crc32_hex : String
crc32_hex,
etag : String
etag,
extract(target_path : Path | String, overwrite : Bool = true) : Bool
extract,
mime_type : String
mime_type,
open : IOopen(&block : IO -> T) : T forall T open, path : String path, sha256 : String sha256, sha256_bytes : Bytes sha256_bytes, size : Int64 size, storage_mode : StorageMode storage_mode, strong_etag : String strong_etag, to_s(io : IO) : Nil
to_s : String to_s, to_slice : Bytes to_slice, verify_crc32? : Bool verify_crc32?, verify_sha256?(expected_digest : String) : Bool verify_sha256?, volume_name : String volume_name
Constructor methods inherited from class Bakelite::Item
new(path : String, volume_name : Symbol | String, size : Int64, compressed_size : Int64, mime_type : String, crc32 : UInt32, storage_mode : StorageMode, sha256 : String | Nil = nil)
new
Class methods inherited from class Bakelite::Item
normalize_sha256(digest : String) : String
normalize_sha256
Constructor Detail
Fast constructor from string literal
Instance Method Detail
Recomputes the CRC32 checksum by streaming the uncompressed content.
Recomputes the lowercase hex SHA-256 digest by streaming the uncompressed content.
Opens a readable stream for this asset.
Streams the content into the given output IO.
Returns the content as a UTF-8 String.
Returns the full contents as a byte slice.