Create temporary files and directories
BSD-3-CLAUSE License
Published by abhinav 9 months ago
This release contains a few breaking changes.
Instead of TempDir.dir
or TempFile.file
, which held an open handle, you must now call TempDir.open
or TempFile.open
. Remember to close the returned handle separately from the Temp{Dir, File}
.
-var dir = temp_dir.dir
+var dir = try temp_dir.open(.{});
+defer dir.close();
To prevent mixing up with with std.fs.{Dir, File}.close()
, the Temp{Dir, File}
objects are now freed by the deinit
method.
var temp_dir = try TempDir.create(..);
-defer temp_dir.close();
+defer temp_dir.deinit();
TempDir
, TempFile
: Add open
methods to get an std.fs.Dir
or std.fs.File
for the temporary artifact.create_file
and create_dir
convenience functions for when TempFile.create
and TempDir.create
aren't necessary.TempDir
, TempFile
: Replace close
with deinit
.TempDir
: Drop dir
field. The open
method should be used instead.TempFile
: Drop file
field. The open
method should be used instead.Published by abhinav 9 months ago
This is the first release of this library.
To use it, ensure that you have Zig 0.11 or newer,
and in a project with a build.zig.zon file,
run the following command:
zig fetch --save 'https://github.com/abhinav/temp.zig/archive/0.1.0.tar.gz'
See https://abhinav.github.io/temp.zig for documentation.