3 Star 2 Fork 0

damone / oss-upload

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

oss-upload

介绍

阿里云 OSS 文件上传

安装教程

  1. 安装 golang 开发环境, 版本大于1.5

  2. 下载 阿里云 oss SDK

go get github.com/aliyun/aliyun-oss-go-sdk/oss
  1. 下载 config
go get github.com/larspensjo/config
  1. 交叉编译 upload
GOOS=linux      GOARCH=arm      go build -o upload-arm-linux        upload.go
GOOS=linux      GOARCH=amd64    go build -o upload-amd64-linux      upload.go
GOOS=windows    GOARCH=amd64    go build -o upload-amd64-windows    upload.go

使用说明

  1. 指令帮助
 ./upload-amd64-windows  -h
Usage of E:\project\viti\oss-upload\upload-amd64-windows:
  -c string
        General configuration file (default "config.ini")
  -d    When upload finished, delete local file
  -w string
        Upload work directory (default "./")
  1. 参数 -c 指定 配置文件,默认 config.ini 文件, 配置内容如下:
[upload]
device_id       = <device id>
oss_end_point   = <oss-cn-beijing.aliyuncs.com>
oss_bucket      = <bucket name>
oss_access_id   = <ali oss access id>
oss_access_key  = <ali oss access key>
  1. 参数 -w 指定上传的本地目录, 默认当前目录

  2. 参数 -d 指定上传完成后是否删除本地文件

./upload  -c data/passengers.ini  -w video/ -d
Transfer video//20190105_14-23-43_0.json Started, ConsumedBytes: 0, TotalBytes 29505.
Transfer video//20190105_14-23-43_0.json Data, ConsumedBytes: 29505, TotalBytes 29505, 100%.Transfer video//20190105_14-23-43_0.json Started, ConsumedBytes: 29505, TotalBytes 29505.
Upload 0: 20190105_14-23-43_0.json status: true
Upload video//20190105_14-23-43_0.json finished, to delete it
Transfer video//20190105_14-23-43_0.log Started, ConsumedBytes: 0, TotalBytes 11507.
Transfer video//20190105_14-23-43_0.log Data, ConsumedBytes: 11507, TotalBytes 11507, 100%.Transfer video//20190105_14-23-43_0.log Started, ConsumedBytes: 11507, TotalBytes 11507.
Upload 1: 20190105_14-23-43_0.log status: true
Upload video//20190105_14-23-43_0.log finished, to delete it
Transfer video//20190105_14-24-00_0.json Started, ConsumedBytes: 0, TotalBytes 36071.
Transfer video//20190105_14-24-00_0.json Data, ConsumedBytes: 36071, TotalBytes 36071, 100%.Transfer video//20190105_14-24-00_0.json Started, ConsumedBytes: 36071, TotalBytes 36071.
Upload 2: 20190105_14-24-00_0.json status: true
Upload video//20190105_14-24-00_0.json finished, to delete it
Transfer video//20190105_14-24-00_0.log Started, ConsumedBytes: 0, TotalBytes 13837.
Transfer video//20190105_14-24-00_0.log Data, ConsumedBytes: 13837, TotalBytes 13837, 100%.Transfer video//20190105_14-24-00_0.log Started, ConsumedBytes: 13837, TotalBytes 13837.
Upload 3: 20190105_14-24-00_0.log status: true
Upload video//20190105_14-24-00_0.log finished, to delete it
Transfer video//20190105_14-24-00_1.json Started, ConsumedBytes: 0, TotalBytes 35924.
Transfer video//20190105_14-24-00_1.json Data, ConsumedBytes: 35924, TotalBytes 35924, 100%.Transfer video//20190105_14-24-00_1.json Started, ConsumedBytes: 35924, TotalBytes 35924.
Upload 4: 20190105_14-24-00_1.json status: true
Upload video//20190105_14-24-00_1.json finished, to delete it
Transfer video//20190105_14-24-00_1.log Started, ConsumedBytes: 0, TotalBytes 13783.
Transfer video//20190105_14-24-00_1.log Data, ConsumedBytes: 13783, TotalBytes 13783, 100%.Transfer video//20190105_14-24-00_1.log Started, ConsumedBytes: 13783, TotalBytes 13783.
Upload 5: 20190105_14-24-00_1.log status: true
Upload video//20190105_14-24-00_1.log finished, to delete it

Comments ( 0 )

Sign in for post a comment

About

阿里云 OSS 文件上传 spread retract
Go
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
Go
1
https://git.oschina.net/damone/oss-upload.git
git@git.oschina.net:damone/oss-upload.git
damone
oss-upload
oss-upload
master

Search

103611 48b8ff67 1899542 103622 4d02230c 1899542