Restart (once again)

This commit is contained in:
Caleb J. Gardner
2026-01-15 06:40:59 -06:00
parent ad7aa271ea
commit 428f938c3a
14 changed files with 395 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
//! A File that's meant where it's meaningful content starts at a given offset.
const std = @import("std");
const File = std.fs.File;
const Reader = std.fs.File.Reader;
const OffsetFile = @This();
fil: File,
offset: u64,
pub fn init(fil: File, init_offset: u64) OffsetFile {
return .{ .fil = fil, .offset = init_offset };
}
pub fn readerAt(self: OffsetFile, offset: u64, buffer: []u8) !Reader {
var rdr = self.fil.reader(buffer);
try rdr.seekTo(self.offset + offset);
return rdr;
}