InoDrive / File / read
InoDrive.File.read(files, transferType)
Read file(s) from the InoDrive module by providing file path and content type.
Arguments:
• Files (Object or Array): A single object or an array of objects to iterate through. Each entry needs a file path and content type (‘JSON’ or ‘String’).
• Transfer Type (Number): TLV command header, only to be used for reading the whole User Application or Firmware file. For non-UserApp/Firmware files (most use-cases) it can remain blank
Returns: File Content (Object or Array) – An Array of objects with either JSON or String UTF-8 content. If only one file, it Returns first element in the list.
// Import InoDrive API Library import { InoDriveApiJS } from ( "ck-inodrive-api" ) // Instatiate the API let InoDriveApi = new InoDriveApiJS.InoDriveApi({ connectAppUrl: "", secure: false }) // Instantiate InoDrive Object Drive = await InoDriveApi.InoDrive({target:'Name'}) // Read File at Path and Return content in a JSON (object) format let content = await Drive.File.read({path: "/dir/foo.json", content: "json"}) // Also can read multiple files at once by storing them in an array let files = [ {path: "/dir/file1.json", content: "json"}, {path: "/dir/file2.json", content: "json"} ] content = await Drive.File.read(files) // Then you may choose to console log or process this information returned to you console.log(content)