InoDrive / File / write


InoDrive.File.write()

Write file(s) operation to InoDrive with provided file path and content object.

Arguments:
Files (Object) – A single object or an array to iterate through. Each entry needs a file path and content which could be a blob in Raw Binary, a json object.
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: Boolean – True or False on successfully writing file(s) out.

// Import InoDrive API Library and File-System Node API
import { InoDriveApiJS }  from ( "ck-inodrive-api" ) 
import readFile  from ( "node:fs" ) 

// Instatiate the API
let InoDriveApi = new InoDriveApiJS.InoDriveApi({ connectAppUrl: "", secure: false })

// Instantiate InoDrive Object
Drive = await InoDriveApi.InoDrive({target:'Name', autoConnect:True})

// Read the file before writing, ensure the target exists and/or the path is clear for a new file
let contentCheck = await Drive.File.read({path: "/dir/foo.json", content: "json"})
console.log(contentCheck)

// Select the File to Write
let newContent =  

// Write the File out
await Drive.File.write({'path': "/dir/foo.json", content: newContent})