From c8f38aaa9f8de1755bbcdd1fe4f1845d4ed5ead2 Mon Sep 17 00:00:00 2001 From: Leonid Emar-Kar Date: Thu, 11 Jan 2024 17:50:09 +0000 Subject: [PATCH] add RevertOnErr option to remove broken files --- options.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/options.go b/options.go index 9fc5489..9e7b972 100644 --- a/options.go +++ b/options.go @@ -8,6 +8,7 @@ type options struct { force bool contentOnly bool move bool + revert bool } func defaultOptions() *options { @@ -37,3 +38,6 @@ func WithBufferSize(size int) optFunc { o.bufSize = size } } + +// RevertOnErr removes destination file if there was an error during copy process. +func RevertOnErr(o *options) { o.revert = true }