Documentation
¶
Overview ¶
Package fileutils defines generic file utilities.
Index ¶
- func CopyFile(ctx context.Context, srcFilePath string, dstPath string) error
- func MarshalPrettyJSON(m proto.Message) ([]byte, error)
- func PathExists(path string) (bool, error)
- func ReadFile(ctx context.Context, filePath string) ([]byte, error)
- func WriteBytesToFile(ctx context.Context, input []byte, outFilePath string) error
- type ContextualReaderWrapper
- type ContextualWriterWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
CopyFile copies the file or directory at srcFilePath to dstPath. If dstPath is a directory, the file is placed within it.
func MarshalPrettyJSON ¶
MarshalPrettyJSON marshals the proto message into pretty, human-readable JSON.
func PathExists ¶
PathExists returns whether the path exists. Returns a non-nil error if unable to determine if the path exists.
Types ¶
type ContextualReaderWrapper ¶
type ContextualReaderWrapper struct {
// contains filtered or unexported fields
}
ContextualReaderWrapper is a wrapper around an existing io.Reader that allows for the interruption of reads with the cancellation of a context.
func NewContextualReaderWrapper ¶
func NewContextualReaderWrapper(ctx context.Context, reader io.Reader) *ContextualReaderWrapper
NewContextualReaderWrapper initializes a new ContextualReaderWrapper.
type ContextualWriterWrapper ¶
type ContextualWriterWrapper struct {
// contains filtered or unexported fields
}
ContextualWriterWrapper is a wrapper around an existing io.Writer that allows for the interruption of writes with the cancellation of a context.
func NewContextualWriterWrapper ¶
func NewContextualWriterWrapper(ctx context.Context, writer io.Writer) *ContextualWriterWrapper
NewContextualWriterWrapper initializes a new ContextualWriterWrapper.