Barite is a library to access the Backblaze B2 API.
It is far from complete, but will have functions added as I need them. Contributions are welcome if you need a feature that isn't covered.
It currently supports enough to be able to transfer individual files to and from B2 buckets.
Add the dependency to your
dependencies: barite: github: gundy818/barite
require "barite" # Initialise the API. b2 = Barite::B2.new("my key id", "my key") # Define a file in a specific bucket. b2file = b2.file("bucket_name", "the/file.txt") # Upload the file from a local copy. b2file.upload("/path/to/local/file.txt") # Download the file to a local copy. b2file.download("/where/to/put/the/download/file.txt")
If there are exceptions, they'll probably be 'Barite::Exception' subclasses. The most likely ones are 'Barite::Exception::AuthenticationException' if there is a problem with your key, or a 'Barite::Exception::NotFoundException' if something you were trying to access couldn't be found. Hopefully the accompanying message will help you understand the problem.
There are no special requirements. There are no real tests at the moment, as I'm figuring out the best way to do this against the actual API, or by mocking it somehow. Suggestions are welcome!
I will be adding functionality to be able to remove files and work with file versions, and also to set life cycle rules to automatically remove old versions.
- Fork it (https://github.com/gundy818/barite/fork)
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request
- darryl - creator and maintainer
- 1 day ago
- June 7, 2021
Sat, 19 Jun 2021 08:06:54 GMT