Package Exports
- raycast-hid
- raycast-hid/distribution/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (raycast-hid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
raycast-hid
Access USB HID devices from Raycast
Install
npm i raycast-hidUsage
1. Setup prebuilds to your extension
Run npx raycast-hid-setup under your extension project directory to prepare HID prebuilds to the assets folder to your extension.
2. Prepare prebuilds bebofre running your extension
Remember to run preparePrebuilds() before you use any function from the HID.
import { useEffect, useState } from "react";
import { List } from "@raycast/api";
import { HID, preparePrebuilds } from "raycast-hid";
export default function Command() {
const [isLoading, setIsLoading] = useState(true);
const loadPrebuilds = async () => {
await preparePrebuilds();
setIsLoading(false);
console.log(HID.devices());
};
useEffect(() => {
loadPrebuilds();
}, []);
return <List isLoading={isLoading} />;
}API
preparePrebuilds()
This function programmatically copies the prebuilds files from assets/prebuilds to the correct directory for node-hid.
HID
This exposes all node-hid functions. For example:
import { HID } from "raycast-hid";
console.log(HID.devices());Related
- node-hid - Access USB & Bluetooth HID devices through Node.js
License
MIT