06-13-2021 07:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-13-2021 07:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I would like to be able to send a binary file from the device to the companion and receive it correctly. when I receive the file with pop() and try to retrieve the contents with file.arrayBuffer(), I get [object ArrayBuffer] and cannot see the contents. Is the payload correctly receiving the file when it outputs [object ArrayBuffer]? When I receive it with text(), nothing is displayed.
I look forward to working with you.
The program is shown below.
let file;
while ((file = await inbox.pop())) {
//console.log(`file contents`);
console.log(`Received File: <${file.name}>`);
const payload = await file.arrayBuffer();
console.log(`file contents: ${payload}`);
}
output↓
06-13-2021 13:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-13-2021 13:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
It may not be valid to try to display the contents of an ArrayBuffer like that. For a start, javascript doesn't know what types of values are in the array.
Try creating a typed array of the correct type. You may need to iterate through it to see its contents.
Gondwana Software

06-13-2021 16:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-13-2021 16:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you very much.

