File.replaceReadwrite

gio.file_iostream.FileIOStream replaceReadwrite(string etag, bool makeBackup, gio.types.FileCreateFlags flags, gio.cancellable.Cancellable cancellable = null)

Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. If the file doesn't exist, it will be created.

For details about the behaviour, see [gio.file.File.replace] which does the same thing but returns an output stream only.

Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing.

Parameters

etagan optional entity tag for the current #GFile, or #NULL to ignore
makeBackuptrue if a backup should be created
flagsa set of #GFileCreateFlags
cancellableoptional #GCancellable object, null to ignore

Returns

a #GFileIOStream or null on error.

Free the returned object with [gobject.object.ObjectWrap.unref].

Throws

[ErrorWrap]