temp.zig

Create temporary files and directories

BSD-3-CLAUSE License

Stars
5
temp.zig - 0.3.0 Latest Release

Published by abhinav 4 months ago

Added

  • Add support for Zig 0.12 and 0.13.

Removed

  • Drop support for Zig 0.11.
temp.zig - 0.2.0

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();

Added

  • TempDir, TempFile: Add open methods to get an std.fs.Dir or std.fs.File for the temporary artifact.
  • Add create_file and create_dir convenience functions for when TempFile.create and TempDir.create aren't necessary.

Changed

  • TempDir, TempFile: Replace close with deinit.

Removed

  • TempDir: Drop dir field. The open method should be used instead.
  • TempFile: Drop file field. The open method should be used instead.
temp.zig - 0.1.0

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.