blob

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package blob is content-addressed attachment storage under blobs/sha256/ab/cd<rest> (RFC 8.1).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is the blob directory.

func New

func New(dataDir string) *Store

New returns a store rooted at dir/blobs.

func (*Store) CopyReadOnly

func (s *Store) CopyReadOnly(atts []envelope.Attachment, dir string) (map[string]string, error)

CopyReadOnly materialises attachments into dir as read-only files with sanitised names and returns their paths keyed by name.

func (*Store) Get

func (s *Store) Get(sha string) ([]byte, error)

Get reads a blob.

func (*Store) Path

func (s *Store) Path(sha string) string

Path returns where a blob lives.

func (*Store) Put

func (s *Store) Put(data []byte, mime string) (sha string, outMime string, err error)

Put writes data and returns its sha256 and a sniffed MIME type.

func (*Store) PutFile

func (s *Store) PutFile(path string) (sha string, size int64, mime string, err error)

PutFile stores a file from disk.

func (*Store) Remove

func (s *Store) Remove(sha string) error

Remove deletes a blob file.

Jump to

Keyboard shortcuts

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