putlib

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

putlib project main.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PutConfig

type PutConfig struct {
	PathToWorkdir bool
	// Client is the HTTP client used for uploads. When nil, http.DefaultClient
	// is used. Set it to control TLS behavior (e.g. InsecureSkipVerify).
	Client *http.Client
	// Progress, when non-nil, receives a Write for every chunk of the request
	// body sent, so callers can render an upload progress bar. For a directory
	// that is the file bytes plus one manifest per directory, so the total can
	// exceed a bar sized from file sizes alone. Writes are best-effort: an
	// error from the writer is discarded and never aborts the upload.
	Progress io.Writer
	// Retention, when non-empty, is sent as the Tie-Retention header on every
	// upload: a Go duration (e.g. "72h") or "infinite". Empty means the server
	// default (permanent).
	Retention string
	// OwnerToken, when non-empty, is sent as the Tie-Owner header so the owner
	// can later change the blob's retention. It is a shared secret, not stored
	// in plaintext on the server.
	OwnerToken string
	// Store, when non-empty, is sent as the Tie-Store header to select which
	// physical store on a multi-store filehost receives the blob. Empty targets
	// the filehost's default store.
	Store string
}

func (*PutConfig) AddressOf

func (pc *PutConfig) AddressOf(input io.Reader) (string, error)

func (*PutConfig) AddressOfFile

func (pc *PutConfig) AddressOfFile(file string) (string, error)

func (*PutConfig) UploadFile

func (pc *PutConfig) UploadFile(url string, path string) StatusItem

func (*PutConfig) UploadMultipart

func (pc *PutConfig) UploadMultipart(url string, f io.Reader, length int, path string) StatusItem

type Status

type Status struct {
	LastItem      StatusItem
	UploadedItems []StatusItem
	ErrorMsg      string
}

func Upload

func Upload(url string, file string, config PutConfig) *Status

type StatusItem

type StatusItem struct {
	Hash      string
	MediaType string
	Filename  string
	ErrorMsg  string
	Size      int
	Head      []byte // first bytes of the content, for recomputable media-type detection
}

Jump to

Keyboard shortcuts

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