InoDrive / File / read
InoDrive.File.read(self, files=None, transfer_type=None)
Read file(s) operation from InoDrive with provided file path and content type.
Arguments:
• self (Object): Reference to InoDrive File Instance.
• files (Dict or List): A single File or a group of Files to iterate through. Each entry needs a File Path and content type ('json' or 'string').
• transfer_type (Number): TLV command header, for non UserApp/Firmware files it can remain blank or None.
Returns: List – A List of Dictionaries with either JSON or String UTF-8 content. If only one file, Returns first element in the list.
import CkInoDriveAPI # Instantiate InoDrive Object and Connect by Name Drive = CkInoDriveAPI.InoDrive(target='Name', autoConnect=True) # Read File at Path and Return content in a JSON (Dict) Format content = Drive.File.read({'path': '/dir/foo.json', 'content': 'json'}) # Read File at Path and Return content in a String Format content = Drive.File.read({'path': '/dir/foo.json', 'content': 'string'}) # Read Multiple Files files = [ {'path': '/dir/file1.json', 'content': 'json'}, {'path': '/dir/file2.json', 'content': 'json'} ] content = Drive.File.read(files)