How can I use particle-usb?

I was browsing GitHub and I found this repository which looks like it will be really useful.

However, the issues tab seems to be disabled.

Also I tried running the example code but it won’t run in Node.js 9.5.0.

Here is the first error I get.

import * as usb from 'particle-usb';

SyntaxError: Unexpected token import
    at new Script (vm.js:51:7)
    at createScript (vm.js:138:10)
    at Object.runInThisContext (vm.js:199:10)
    at Module._compile (module.js:624:28)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:190:16)

If I try this, I get:

(node:63386) ExperimentalWarning: The ESM module loader is experimental.
const devices = await usb.getDevices();
SyntaxError: Unexpected reserved word
    at loaders.set (internal/loader/ModuleRequest.js:33:13)
    at <anonymous>

Here are my node and npm versions:


Is particle-usb too new for users to test?

Ping @kennethlimcp

I’m not familiar with web stuff but looks like a WIP cool thing. You can probably follow along with new commits and I’m sure you will see what is it all about eventually. :slight_smile:

1 Like