npm.io
0.2.1 • Published 2 years ago

jomiel-messages

Licence
Apache-2.0
Version
0.2.1
Deps
1
Size
147 kB
Vulns
0
Weekly
0

jomiel-messages-js

npm-package code-style

The javascript bindings for the jomiel protobuf messages.

  • Easy to install jomiel protobuf message bindings for js
  • Generated from the jomiel-proto declarations

Installation

npm install jomiel-messages

Usage

Serialize an inquiry message:

import jomielMessages from "jomiel-messages";

const { Inquiry } = jomielMessages.jomiel.protobuf.v1beta1;
const uri = "https://...";

const msg = Inquiry.create({ media: { inputUri: uri } });
const bytes = Inquiry.encode(msg).finish();

// ...

Deserialize the response message:

const { Response, StatusCode } = jomielMessages.jomiel.protobuf.v1beta1;

// bytes: data read from the zeromq socket (returned by jomiel)
const msg = Response.decode(bytes);

if (msg.status.code !== StatusCode.STATUS_CODE_OK) {
  const status = msg.status;
  // ...
}

License

jomiel-messages is licensed under the Apache License version 2.0.

Acknowledgements

Subprojects (git-subtree)

Keywords