class Barite::B2File
- Barite::B2File
- Reference
- Object
Overview
Represents a file in a specific bucket on Backblaze. This is normally generated by calling B2#file. Once you have this object you can upload and download the file using B2File#upload, B2File#download.
Defined in:
barite.crConstructors
-
.new(b2 : Barite::B2, bucket_name : String, file_name : String)
Create a reference for the named file in the named bucket.
Instance Method Summary
-
#b2 : Barite::B2
The linked B2 object.
-
#bucket_id : String
Retrieve the bucket ID.
-
#bucket_name : String
The bucket containing this file.
-
#download(local_file_path : String)
Downloads the referenced file to a local file.
-
#file_name : String
The filename as stored in the bucket.
-
#upload(local_file_path : String)
Upload the file from the local file path.
-
#upload_token : String
Retrieve the upload token for the bucket.
-
#upload_url : String
Retrieve the upload URL.
Constructor Detail
Create a reference for the named file in the named bucket. Note that the @max_versions parameter is not yet used. Every time you upload the same file name you will create a new version of the same file. Note that B2 filenames are strings but they can include a path, such as "abc/def". Some tools will interpret this as a file called 'def' in a folder 'abc', and it is OK to think of it like this, but the 'abc/' is really just part of the filename.
Instance Method Detail
Downloads the referenced file to a local file. local_file_path is the pull path, including filename. If the stored file has a modification time stored in a "X-Bz-Info-src_last_modified_millis" header, the timestamp will be set on the file after a successful download.
Upload the file from the local file path. The modification time from the local file is set in the "X-Bz-Info-src_last_modified_millis" header, so it will be returned when the file is downloaded.
Retrieve the upload token for the bucket. Caches the result on first use. Upload tokens seem to be re-usable, so you only need to get it once.