diff --git a/src/archive.zig b/src/archive.zig index 5b8e3be..b0bc21f 100644 --- a/src/archive.zig +++ b/src/archive.zig @@ -61,9 +61,8 @@ pub fn init(alloc: std.mem.Allocator, fil: File) !Archive { try std.Thread.getCpuCount(), ); } -/// Create the Archive dictating the amount of threads & memory used. -/// If trying to extract a full archive, a large memory size & thread count could help. -/// If you're planning on only interacting with a small number of files, it should be fine to use few threads and a small memory size. +/// Create the Archive dictating the amount of threads used for extraction. +/// If you're planning on only interacting with a small number of files, it should be fine to use few (or one) threads. pub fn initAdvanced(alloc: std.mem.Allocator, fil: File, offset: u64, threads: usize) !Archive { var super: Superblock = undefined; const red = try fil.pread(@ptrCast(&super), offset); diff --git a/src/inode.zig b/src/inode.zig index 8182090..5c39e1d 100644 --- a/src/inode.zig +++ b/src/inode.zig @@ -378,7 +378,7 @@ fn extractThread( /// /// Assumes the inode is a file or ext_file type. fn extractRegFile(self: Inode, alloc: std.mem.Allocator, archive: *Archive, path: []const u8, options: ExtractionOptions) !void { - var fil = try std.fs.cwd().createFile(path, .{}); + var fil = try std.fs.cwd().createFile(path, .{ .exclusive = true }); defer fil.close(); var wrt = fil.writer(&[0]u8{}); var dat_rdr = try self.dataReader(alloc, archive);