Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

querying filename in inbox of companion

In this code below, is there any function to call the filename?

When I use "inbox.nextFile();" I get error msg that "e.inbox.nextFile is not a function"

import { inbox } from "file-transfer";

// Process the inbox queue for files, and read their contents as text
async function processAllFiles() {
   let file;
   while ((file = await inbox.pop())) {
     const payload = await file.text();
     console.log(`file contents: $‌{payload}`);
   }
}

// Process new files as they are received
inbox.addEventListener("newfile", processAllFiles);

// Also process any files that arrived when the companion wasn’t running
processAllFiles()

 

Best Answer
0 Votes
3 REPLIES 3

Are you possibly trying to run device API code in the companion?

Peter McLennan
Gondwana Software
Best Answer
0 Votes

No, I am not.

 

I am trying to transfer a file from device to companion which has its local storage and I need to get the name of file. 

I know how to store it in local storage but don't know how to get the name. 

 

Best Answer
0 Votes
Best Answer
0 Votes