file

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage stores data in an unencrypted file.

func New

func New(p string) (*Storage, error)

New is the constructor for Storage. "p" is the path to the file in which to store data.

func (*Storage) Delete

func (s *Storage) Delete(context.Context) error

Delete deletes the file, if it exists.

func (*Storage) Read

func (s *Storage) Read(context.Context) ([]byte, error)

Read returns the file's content or, if the file doesn't exist, a nil slice and error.

func (*Storage) Write

func (s *Storage) Write(ctx context.Context, data []byte) error

Write stores data in the file, overwriting any content, and creates the file if necessary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL