func (b *Bucket) UploadHashedFile(name string, meta map[string]string, file io.Reader, sha1Hash string, contentLength int64) (*File, error) {
	uploadURL, auth, err := b.internalGetUploadURL()
	if err != nil {
		return nil, err
	}
	if b.b2.Debug {
		fmt.Printf("         Upload: %s/%s\n", b.Name, name)
		fmt.Printf("           SHA1: %s\n", sha1Hash)
		fmt.Printf("  ContentLength: %d\n", contentLength)
	}
	req, err := http.NewRequest("POST", uploadURL.String(), file)
	if err != nil {
		return nil, err
	}
	req.Header.Add("Authorization", auth.AuthorizationToken)
	req.ContentLength = contentLength
	req.Header.Add("Content-Type", "b2/x-auto")
	req.Header.Add("X-Bz-File-Name", url.QueryEscape(name))
	req.Header.Add("X-Bz-Content-Sha1", sha1Hash)
	if meta != nil {
		for k, v := range meta {
			req.Header.Add("X-Bz-Info-"+url.QueryEscape(k), url.QueryEscape(v))
		}
	}
	resp, err := b.b2.httpClient.Do(req)
	if err != nil {
		auth.invalidate()
		return nil, err
	}
	result := &File{}
	if err := b.b2.parseResponse(resp, result, nil); err != nil {
		auth.invalidate()
		return nil, err
	}
	if sha1Hash != result.ContentSha1 {
		return nil, errors.New("SHA1 of uploaded file does not match local hash")
	}
	return result, nil
}
UploadHashedFile Uploads a file to B2, returning its unique file ID.

This method will not retry if the upload fails, as the reader may have consumed
some bytes. If the error type is B2Error and IsFatal returns false, you may retry the
upload and expect it to succeed eventually.
package backblaze
import (
	"bytes"
	"crypto/sha1"
	"encoding/hex"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"github.com/pquerna/ffjson/ffjson"
)
func (b *Bucket) ListFileNames(startFileName string, maxFileCount int) (*ListFilesResponse, error) {
	request := &listFilesRequest{
		BucketID:      b.ID,
		StartFileName: startFileName,
		MaxFileCount:  maxFileCount,
	}
	response := &ListFilesResponse{}
	if err := b.b2.apiRequest("b2_list_file_names", request, response); err != nil {
		return nil, err
	}
	return response, nil
}
func (b *Bucket) UploadFile(name string, meta map[string]string, file io.Reader) (*File, error) {
	hash := sha1.New()
	var reader io.Reader
	var contentLength int64
	if r, ok := file.(io.ReadSeeker); ok {
		written, err := io.Copy(hash, r)
		if err != nil {
			return nil, err
		}
		r.Seek(0, 0)
		reader = r
		contentLength = written
	} else {
		buffer := &bytes.Buffer{}
		r := io.TeeReader(file, buffer)
		written, err := io.Copy(hash, r)
		if err != nil {
			return nil, err
		}
		reader = buffer
		contentLength = written
	}
	sha1Hash := hex.EncodeToString(hash.Sum(nil))
	f, err := b.UploadHashedFile(name, meta, reader, sha1Hash, contentLength)
	if b2err, ok := err.(*B2Error); ok {
		if !b2err.IsFatal() && !b.b2.NoRetry {
			f, err = b.UploadHashedFile(name, meta, reader, sha1Hash, contentLength)
		}
	}
	return f, err
}