Public
Edited
Jul 4, 2020
1 fork
Importers
1 star
Protocol Buffers
Insert cell
Insert cell
Insert cell
framework = new Promise((resolve, reject) => {
var script = document.createElement('script')
script.setAttribute("type", "text/javascript")
script.setAttribute("src", "https://california.demo.blackpagedigital.com/caffeine/protobuf/protobuf.js")
script.onload = (event) => {resolve(window.protobuf)}
document.getElementsByTagName("head")[0].appendChild(script)})
Insert cell
Insert cell
source = FileAttachment("data.proto").text()
Insert cell
Insert cell
root = new Promise((resolve, reject) => {
framework.load(
source,
function (err, root) {resolve(root)})})
Insert cell
Insert cell
type = root.lookupType('jspb.test.UnnestedData')
Insert cell
payload = ({str: 'hello'})
Insert cell
// Answer an error message if verification fails, or null if it succeeds.
type.verify(payload)
Insert cell
Insert cell
message = type.create(payload)
Insert cell
buffer = type.encode(message).finish()
Insert cell
Insert cell
decoded = type.decode(buffer)
Insert cell
Insert cell
object = type.toObject(decoded)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more