Updating a value in JLD2

Is it possible to update a value written to a JLD2 file? With version 1 there was a delete! method to delete the old value before writing it’s new value. With v2 I don’t see that method. I’ve looked for other methods in the source, but so far haven’t seen anything that implies delete.

Just writing the value again fails:

using JLD2;

file = jldopen("test.jld2", true, true, true)

write(file, "a", "xyz")
write(file, "a", "abc")

close(file)
ERROR: LoadError: ArgumentError: a group or dataset named a is already present within this group

This is now possible.

using JLD2;

file = jldopen("test.jld2", "w")

write(file, "a", "xyz")
Base.delete!(file, "a")
write(file, "a", "abc")

close(file)
3 Likes