[] neofs-cli: Truncate file before writing the object

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-08-23 18:02:19 +03:00 committed by Pavel Karpy
parent 40f1cf36e1
commit d57c57010f

View file

@ -53,7 +53,7 @@ func getObject(cmd *cobra.Command, _ []string) {
if filename == "" {
out = os.Stdout
} else {
f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0644)
f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
if err != nil {
common.ExitOnErr(cmd, "", fmt.Errorf("can't open file '%s': %w", filename, err))
}