github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/file/size.go (about)

     1  // Copyright 2021 The TrueBlocks Authors. All rights reserved.
     2  // Use of this source code is governed by a license that can
     3  // be found in the LICENSE file.
     4  
     5  package file
     6  
     7  import (
     8  	"os"
     9  )
    10  
    11  func FileSize(filename string) int64 {
    12  	info, err := os.Stat(filename)
    13  	if os.IsNotExist(err) {
    14  		return 0
    15  	}
    16  	return info.Size()
    17  }