tiny.cook.digestFile
Defined in tiny.cook.
Source
Source: lib/cook/src/cache.zig:58
zig
pub fn digestFile(io: std.Io, file: std.Io.File) ![32]u8 { const stat = try file.stat(io); var hasher = Sha256.init(.{}); var buffer: [64 * 1024]u8 = undefined; var offset: u64 = 0; while (offset < stat.size) { const wanted: usize = @intCast(@min(stat.size - offset, buffer.len)); const count = try file.readPositionalAll(io, buffer[0..wanted], offset); if (count != wanted) return error.ShortRead; hasher.update(buffer[0..count]); offset += count; } var digest: [32]u8 = undefined; hasher.final(&digest); return digest;}Source: lib/cook/src/root.zig:9
zig
pub const digestFile = cache.digestFile;Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |