Categorygithub.com/sfomuseum/go-atomicwrite
modulepackage
1.0.0
Repository: https://github.com/sfomuseum/go-atomicwrite.git
Documentation: pkg.go.dev

# README

go-atomicwrite

Go package to implement an atomic io.WriteCloser instance backed by the gocloud.dev/blob package.

Documentation

Go Reference

Example

import (
	"context"
	"fmt"
	"github.com/sfomuseum/go-atomicwrite"
)

func main(){

	ctx := context.Background()
	
	fname := "atomicwrite.txt"
	uri := fmt.Sprintf("mem://%s", fname)

	wr, _ := atomicwrite.New(ctx, uri)
	wr.Write([]byte("Hello world"))
	wr.Close()
}

Error handling omitted for the sake of brevity.

See also

# Functions

New returns a new AtomicWriter instance.
NewWithOptions returns a new AtomicWriter instance, specifying 'writer_opts' as the custom options used to create the underlying `blob.Writer` instance.

# Structs

type AtomicWriter implements an atomic io.WriteCloser instance backed by the gocloud.dev/blob package.