Skip to content

partitio/go-file

 
 

Repository files navigation

Go File License GoDoc

Go File is a file server library leveraging go-micro. It enables you to serve and consume files via RPC. It also provide an http handler that can be used in an api-gateway. This is a stripped down version of gotransfer.

Usage

Server

import "github.com/partitio/go-file"

service := micro.NewService(
	micro.Name("go.micro.srv.file"),
)

file.RegisterFileHandler(service.Server(), "/tmp")

service.Init()
service.Run()

Client

import "github.com/micro/go-file"

// use new service or default client
service := micro.NewService()
service.Init()

client := file.NewClient("go.micro.srv.file", service.Client())
client.Download("remote.file", "local.file")

HTTP Server Handler

See the example program

Hand Wavy Bench

Local hand wavy benchmarks for rough estimates on transfer speed

size time taken
1mb 15.590542ms
8mb 75.184788ms
64mb 516.236417ms
128mb 1.141906576s
1024mb 9.794891634s

Using connection pooling and caching selector

size time taken
1mb 13.521179ms
8mb 53.160487ms
64mb 415.388025ms
128mb 889.409332ms
512mb 4.177052391s
1024mb 8.347038098s

About

A file server library using go-micro

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.2%
  • Makefile 1.6%
  • Dockerfile 1.2%