Acquire.Client._filehandle module

class FileHandle(filename=None, remote_filename=None, aclrules=None, drive_uid=None, compress=True, local_cutoff=None)[source]

Bases: object

This class holds all of the information about a file that is held in a Drive, including its size and checksum, and information about previous versions. It provides a handle that you can use to download or delete the file, to upload new versions, or to move the data between hot and cold storage or pay for extended storage

aclrules()[source]

Return the ACL rules for this file

checksum()[source]

Return the checksum of the contents of this file

compression_type()[source]

Return a string describing the compression scheme used by the filehandle when transporting the file, or None if the data is not compressed

drive_uid()[source]

Return the UID of the drive on which this file is located

filename()[source]

Return the remote (object store) filename for this file

filesize()[source]

Return the size (in bytes) of this file

fingerprint()[source]

Return a fingerprint for this file

static from_data(data)[source]

Return an object created from the passed json-deserialised dictionary. Note that this does not contain any information about the local file itself - just the name it should be called on the object store and the size, checksum and acl. If the file (or compressed file) is sufficiently small then this will also contain the packed version of that file data

is_compressed()[source]

Return whether or not the file is compressed on transport

is_localdata()[source]

Return whether or not this file is so small that the data is held in memory

is_null()[source]

Return whether or not this this null

local_filedata(uncompress=False)[source]

Return the filedata for this file, assuming it is sufficiently small to be read in this way. Returns ‘None’ if not…

If ‘uncompress’ is true, then uncompress the data (if it is compressed) before returning

local_filename()[source]

Return the local filename for this file

to_data()[source]

Return a json-serialisable dictionary for this object. Note that this does not contain any information about the local file itself - just the name it should be called on the object store and the size, checksum and acl. If the file (or compressed file) is sufficiently small then this will also contain the packed version of that file data