Public
Edited
Jul 4, 2020
1 fork
Importers
1 star
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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more