From 263083b878c7721282f82d278aede3c90f818f49 Mon Sep 17 00:00:00 2001 From: JinnyYi Date: Wed, 8 Sep 2021 17:17:47 +0800 Subject: [PATCH] docs: Update README --- README.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b290b1b..158e169 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,38 @@ -# go-services-kodo - [![Build Status](https://github.com/beyondstorage/go-service-kodo/workflows/Unit%20Test/badge.svg?branch=master)](https://github.com/beyondstorage/go-service-kodo/actions?query=workflow%3A%22Unit+Test%22) [![Integration Tests](https://teamcity.beyondstorage.io/app/rest/builds/buildType:(id:Services_Kodo_IntegrationTests)/statusIcon)](https://teamcity.beyondstorage.io/buildConfiguration/Services_Kodo_IntegrationTests) [![License](https://img.shields.io/badge/license-apache%20v2-blue.svg)](https://github.com/Xuanwo/storage/blob/master/LICENSE) -[![go storage dev](https://img.shields.io/matrix/go-service-kodo:aos.dev.svg?server_fqdn=chat.aos.dev&label=%23go-service-kodo%3Aaos.dev&logo=matrix)](https://matrix.to/#/#go-service-kodo:aos.dev) +[![](https://img.shields.io/matrix/beyondstorage@go-storage:matrix.org.svg?logo=matrix)](https://matrix.to/#/#beyondstorage@go-storage:matrix.org) + +# go-services-kodo -kodo services support for [go-storage](https://github.com/beyondstorage/go-storage) +[qiniu kodo](https://www.qiniu.com/products/kodo) service support for [go-storage](https://github.com/beyondstorage/go-storage). ## Install ```go go get github.com/beyondstorage/go-service-kodo/v2 ``` + +## Usage + +```go +import ( + "log" + + _ "github.com/beyondstorage/go-service-kodo/v2" + "github.com/beyondstorage/go-storage/v4/services" +) + +func main() { + store, err := services.NewStoragerFromString("kodo://bucket_name/path/to/workdir?credential=hmac::&endpoint=http:") + if err != nil { + log.Fatal(err) + } + + // Write data from io.Reader into hello.txt + n, err := store.Write("hello.txt", r, length) +} +``` + +- See more examples in [go-storage-example](https://github.com/beyondstorage/go-storage-example). +- Read [more docs](https://beyondstorage.io/docs/go-storage/services/kodo) about go-service-kodo.