How to write a file to a device paired via the WebUSB API

384 Views Asked by At

Is it possible to write a file to a USBDevice object after it has been paired in browser? Specifically when the device is mass storage such as a USB Flash Drive or SD card, and a compatible browser (such as Chrome >=61)?

After running the following lines of JS:

const usbDevice = await navigator.usb.requestDevice();

// After selecting the device, and
// assuming that both of these Promises don't throw errors

await usbDevice.open();

Can a transfer (whether isochronous or otherwise) be instantiated to write a new text file to the connected mass storage?

If so, what protocol/s would need to be used in order to do so if the data must be sent raw?

0

There are 0 best solutions below