encode

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(f Form, bufferSize int, tempDir string) http.Handler

Handler form files to the format provided by form. Process request steps:

  1. Retrieve userinput format from URL
  2. Use http.MaxBytesReader to avoid memory abuse
  3. Parse output configuration
  4. Create temp file
  5. Run conversion
  6. Send result file

func Run

func Run(ctx context.Context, bufferSize int, pump pipe.SourceAllocatorFunc, sink pipe.SinkAllocatorFunc) error

Run encoding using Pump as the source and Sinks as destination.

Types

type Form

type Form interface {
	Bytes() []byte
	Parse(*http.Request) (FormData, error)
}

Form provides user-input for http encoding.

type FormData

type FormData struct {
	Input
	Output
}

FormData contains parsed form data.

type Input

type Input struct {
	*fileformat.Format
	multipart.File
}

Input is user-provided input for encoding.

type Output

type Output struct {
	*fileformat.Format
	Sink func(io.WriteSeeker) pipe.SinkAllocatorFunc
}

Output is user-provided output for encoding.

Source Files

  • handler.go
  • pipe.go

Jump to

Keyboard shortcuts

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