Giter Club home page Giter Club logo

gopherb2's Introduction

gopherb2

GopherB2 is a basic library for interacting with Backblaze B2 Storage in Golang

Go Report Card license


Overview


Backblaze B2 Credentials

API credentials must be set in Configuration file or with OS Environment variables. The API URL below is the correct URL as of writing (2017-Aug). You will need to obtain API credentials from the B2 Dashboard. Go to https://secure.backblaze.com/b2_buckets.htm, then click 'Show Account ID and Application Key".

Environment Variables

You can environment variables for gopherb2 to authorize with the Backblaze B2 API. The application will expect the following:

  • B2AcctID
  • B2AppID
  • B2APIURL

To set on macOS & *nix in Terminal:

export B2AcctID=123464abc
export B2AppID=456789ddffgghhii
export B2APIURL=https://api.backblazeb2.com/b2api/v1/

Configuration File

You can also set the necessary credentials in $GOPATH/src/github.com/dwin/gopherb2/config :

nano $GOPATH/src/github.com/dwin/gopherb2/config

You should see a file that appears like the example below that you will need to edit with your credentials:

# BackBlaze B2 API credentials
# You will need to get these from the BackBlaze API Dashboard
[Account1]
  AcctID = "3a1234567b89"
  AppID = "001f38150dfsdgfdsgdfsg80c23b9"
  APIURL = "https://api.backblazeb2.com/b2api/v1/"

Command Line App

CLI Install

To install command line app:

go get github.com/dwin/gopherb2

Make sure your PATH includes the $GOPATH/bin directory so your commands can be easily used:

export PATH=$PATH:$GOPATH/bin

Then:

cd $GOPATH/src/github.com/dwin/gopherb2/gb2 && go install

CLI Usage

gb2 [global options] command [command options] [arguments...]

Show Help

gb2 help

CLI Example

NAME:
   gb2 - [global options] command [command options] [arguments...]

USAGE:
   gb2 [global options] command [command options] [arguments...]

VERSION:
   0.1.0

DESCRIPTION:
   Application for managing and interacting with Backblaze B2

COMMANDS:
     bucket, buckets  [global] bucket [command] [arguments...]
     upload, put      [global] upload [bucket id] [path or file]
     file, files      [global] file [command] [arguments..]
     version, v       Display version
     help, h          Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --log gopher.log                 gb2 -log gopher.log
   --debug -debug|-d, -d -debug|-d  -debug|-d [command]
   --help, -h                       show help
   --version, -v                    print the version

Library Usage

Use go get to obtain gopherb2 library

go get github.com/dwin/gopherb2

Import into project

import (
    "github.com/dwin/gopherb2"
)
func main() {
    err := UploadFile("bucket-id","~/test_file.txt")
    if err != nil {
        // Handle error
    }
}

Planned Features

  • Directory Sync
  • Compress and Upload
  • File Encryption
  • Basic GUI

gopherb2's People

Contributors

dwin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.