OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-deps / @holepunchto / keet-core-schemas / lib / plugins / messages.js

1 lines · javascript ref:
const e=require("compact-encoding"),n={preencode(n,d){n.end++,e.string.preencode(n,d.name),d.key&&(e.fixed32.preencode(n,d.key),e.uint.preencode(n,d.length),e.uint.preencode(n,d.fork))},encode(n,d){const o=n.start++;e.string.encode(n,d.name);let c=0;d.key&&(c|=1,e.fixed32.encode(n,d.key),e.uint.encode(n,d.length),e.uint.encode(n,d.fork)),n.buffer[o]=c},decode(n){const d=e.uint.decode(n);return{name:e.string.decode(n),key:1&d?e.fixed32.decode(n):null,length:1&d?e.uint.decode(n):0,fork:1&d?e.uint.decode(n):0}}};module.exports={PluginRecord:n};