Skip to content

Instantly share code, notes, and snippets.

@roguh
Created September 16, 2025 16:23
Show Gist options
  • Save roguh/1868f8fecd4bebf7c19c65f3fb37efb6 to your computer and use it in GitHub Desktop.
Save roguh/1868f8fecd4bebf7c19c65f3fb37efb6 to your computer and use it in GitHub Desktop.
mtplvcap_command.js: Send commands to mtplvcap, control your Nikon camera through the CLI. See https://github.com/puhitaku/mtplvcap
#!/usr/bin/env node
const addr = process.env.MTPLVCAP_ADDRESS || "ws://localhost:42839/control"
// TODO: add the other mtplvcap commands
const payload = {af_focus_now: true}
let ws = new WebSocket(addr)
ws.onopen = () => {
ws.send(JSON.stringify(payload))
ws.close(1000, "Normal Closure")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment