httpfs

package module
v0.0.0-...-8df8da6 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2017 License: MIT Imports: 6 Imported by: 0

README

httpfs

GoDoc

Golang library for open http file like open local file

Example

Usage in unzip http file

package main

import (
    "github.com/codeskyblue/httpfs"
    "archive/zip"
    "fmt"
    "log"
)

func main(){
    file, err := Open("http://some-host/file.zip")
	if err != nil {
		log.Fatal(err)
	}
    zrd, err := zip.NewReader(file, file.Size())
    if err != nil {
		log.Fatal(err)
	}
    for _, f := range zrd.File {
        fmt.Printf("F-Name: %s\n", f.Name)
    }
}

LICENSE

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptySize       = errors.New("empty size")
	ErrNotAcceptRanges = errors.New("not support Accept-Ranges")
)

Functions

This section is empty.

Types

type HTTPFile

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

func Open

func Open(url string) (file *HTTPFile, err error)

Open return a file like object

func (*HTTPFile) ModTime

func (f *HTTPFile) ModTime() time.Time

func (*HTTPFile) Name

func (f *HTTPFile) Name() string

func (*HTTPFile) ReadAt

func (f *HTTPFile) ReadAt(p []byte, off int64) (n int, err error)

func (*HTTPFile) Size

func (f *HTTPFile) Size() int64

Jump to

Keyboard shortcuts

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