node-qsikit
v1.0.1
Published
A node.js wrapper for IBM's Quantum Experience HTTP API that allows you to connect and execute OPENQASM code.
Downloads
17
Maintainers
Readme
node-qsikit
A node.js wrapper for IBM's Quantum Experience HTTP API that allows you to connect and execute OPENQASM code.
Installation
npm install node-qsikit --save
Dependencies
- request: Simplified HTTP request client.
##Usage: Execute Code:
const qsikit = require('node-qsikit');
var q = new qsikit();
q.connect('your API token', () => {
var qasm = 'OPENQASM 2.0;include "qelib1.inc";qreg q[5];creg c[5];u3(-1.23096,0,0) q[0];u3(pi/4,0,0) q[1];cx q[0],q[2];z q[2];h q[2];cx q[1],q[2];z q[2];u3(pi/4,0,0) q[1];h q[2];cx q[1],q[2];measure q[0] -> c[0];measure q[1] -> c[1];measure q[2] -> c[2];'
var device = "simulator";
var shots = 1000;
var name = "API Wrapper Example";
var timeout = 60;
q.methods.executeCode(qasm, device, shots, name, null, timeout, (result) => {
var data = result.result.data.p;
console.log(data);
});
});
License
ISC