8.7.112 • Published 1 year ago

@swenkerorg/deserunt-eos-eveniet v8.7.112

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@swenkerorg/deserunt-eos-eveniet

Minimal Protocol Buffers wire encoding/decoding

Example

Writer

import Writer from '@swenkerorg/deserunt-eos-eveniet/encoding/writer'
import { uint64, string } from '@swenkerorg/deserunt-eos-eveniet/encoding/types'

const w = new Writer()

w.varint(1, 1024n, uint64) // myInt
w.varint(2, 'Hello world', string) // myString

const buf = w.concat()

Reader

import Reader from '@swenkerorg/deserunt-eos-eveniet/decoding/reader'
import { uint64, string } from '@swenkerorg/deserunt-eos-eveniet/decoding/types'

const buf = new Uint8Array([ /* ... */ ])

const myInt = 0n
const myString = ''

for (const [fieldNumber, { data }] of reader(buf)) {
  switch (fieldNumber) {
    case 1:
      myInt = uint64(data); break
    case 2:
      myString = string(data); break
  }
}

API

Encoding

const writer = new Writer(prealloc = 256)

writer.varint(fieldNumber, value, [codec])

writer.bytes(fieldNumber, value, [codec])

writer.fixed64(fieldNumber, value, [codec])

writer.fixed32(fieldNumber, value, [codec])

const buf = writer.concat([buf], [byteOffset])

Decoding

const iter = reader(buf, [byteOffset], [byteLength])

const msg = new Uint8Array([ /* ... */ ])

for (const [fieldNumber, field] of reader(msg)) {
  const {
    tagByteOffset,
    tagByteLength,
    // The tag is essentially `fieldNumber << 3 | wireType`
    fieldNumber,
    wireType,
    // Total length of the data, eg. including a length prefix or extra bytes for varints
    dataByteLength,
    // The actually value of the field decoded based on the wireType:
    //
    // - varint: bigint
    // - fixed32: Uint8Array subarray
    // - fixed64: Uint8Array subarray
    // - bytes: Uint8Array subarray
    //
    // The fixed size integers are represented as Uint8Arrays since there's no easy way
    // to cast a integer to a double/float without using DataView's, which in turn expect
    // a TypedArray
    data
  } = field
  // ...
}

Install

npm install @swenkerorg/deserunt-eos-eveniet

License

MIT

typedpushECMAScript 2023awsgdprajaxgesturesdateexecutableredirectpicomatchcssreal-timefunction.lengthpreserve-symlinksduplexfetchlook-upvariablesstoragegatewayapisameValueZerocolorsthroatisconcatMaptsinspectieparserWebSocketrgbESrequestmomentapollonegative zeroRegExp#flagselasticachefast-copyclientbyteOffsetloggeres-abstractpersistentmkdirArray.prototype.filterRxJStoSorteddefaultwaapifunctionsconfigurablenameses7linkspinnercorereadableconfigdataviewdeleteimmutablewarningserializeremrfind-uptypeerrormatchesbluebirdsettera11yopensrandomBigInt64ArrayrangeerrorconcatpostcssidlebundlernodejsArray.prototype.containsString.prototype.trimupautoscalingframeworkmkdirpimportexportcensordeepcloneregular expressions@@toStringTagwhatwgio-tsequalpackagessymlinksuperagentglobalsUint8ArrayfunctionserializesequenceregularcoloreventEmitterfast-cloneassigntraversejasmineserializationtypedarrayskeysRegExp.prototype.flagsdrophttpcircularawesomesaucecore-jscollectionsyntaximmerwritablecolumnsawaitefficientlaunchtypescripttapES2017dependency managerdires2018fastbatchformstoolscheckperformancelengthUint32Arraycurlcode pointsStyleSheetnodetoolkitarktypeArray.prototype.includesjsonpathfolderstylingvarsmochaconsolephonetrimStartReactiveXredux-toolkitargsinternaldebugchannelworkflowgetOwnPropertyDescriptorcryptothrottleObject.valuesvaluepackage managercontainsfullwidthObject.fromEntriesmruiamobjstyletouchregexpajvObject.entriesswfinputfindArrayBufferwalkdependenciesObject.definePropertylruArray.prototype.flattenyupdragasyncxhrenderansicollection.es6monorepoebscallmake dirdeepcopytoStringTaguninstallyamlmodulei18nfigletvaluessymlinkssimpledbmkdirsObservableECMAScript 2019-0testingArray.prototype.findLaststatelesseast-asian-widthbddruntimeinstallerreadtslibHyBimime-dbbusyArray.prototype.flat$.extendparseoptimizerrequireloadbalancingcloudfrontformattingopenmatchsomequeueMicrotaskYAMLframerttypnpm9IteratorsortString.prototype.matchAlltostringtagsliceidentifierswebslotassertsinternal slotspinnersECMAScript 3environmentES8callboundlimitedreducestreams2Float64ArraysafegroupBypositiveECMAScript 5Function.prototype.nameprotocol-bufferssharedarraybufferreactunicodeargumentsECMAScript 2016full-widthexecECMAScript 2022clilanguagekarmapropertiesreducerimportutilitiesdeep-copyfiledatastructureES3parsingfullhasdebuggerconcurrencymapreducereact-hooksstartertc39mapintrinsicredactchromeastargvdefinePropertyquerystringtypeofwebsiteweaksetelbURLeveryl10nglobexeoptionspawnsyntaxerrorpropES6joiprettyECMAScript 2015threecommand-lineminimalponyfillespreegraphqlbreaktrimLeftexpressionarraycoerciblesymbolWebSocketsrm -rfjsreact-testing-librarygetoptES2018Objectstyled-componentses2015qsemojicharsetlookmatchAllutilityArraylocationconsumeglacierdescriptionvisualnpmchromiummetadatacompilerWeakMapstylesbanneroncetakermbyteinferenceroute53genericsreadablestreamcall-bindgetPrototypeOfcodespatchescapehashtesterStreamsprotobuffastcopybrowserlistequalityiteratexdgArrayBuffer#sliceoutputcmddeterministicec2electroncomputed-typeshardlinksprotoinvariantscheme-validationloggingspringwhichES2016globalTypeScriptcharactersgetUint16Arrayspeedsymbolsurltypedarrayhelperscomparereact-hook-formassertionSymbolwidthjshintstringifyplugintrimRightES2020nopeclonegetterUint8ClampedArrayprivate datalistenersInt16ArraydataViewbindes6offsetECMAScript 2020setchairfc4122defineES2023createveststructuredCloneworkerxdg-opentypesaferm -frschemehookformutilpostcss-pluginsearchURLSearchParamslazygroupjsdifftelephonekoreanairbnbdescriptorpackage.jsonsortedmergeECMAScript 7jsxloadingnativeassertwordbreakomiteslintconfigECMAScript 2017eslintproxysetPrototypeOffastclonepipewalkingworkspace:*appCSStoArrayvalidatehttpsiconv_.extendpackagehas-ownPromiseflatprivatemodulesform-validationgetintrinsices2017wafbundlingutil.inspectSymbol.toStringTagObject.assigncacheicuTypeBoxguidamazonsqstyped arrayeventDispatcherquotecloudsearchindicatorartpromiseclass-validatorresolveiteratorqueue__proto__commandPushfile systemzeroAsyncIteratorESnextconvertwaitRFC-6455expressurlsfindLastIndextimeRxobjectprogressformes8boundentriestermlogreact posevalidextensionstdlib3dFloat32ArrayecmascriptinsetImmediate[[Prototype]]sideReflect.getPrototypeOfshrinkwrapMapjavascriptuuidkinesisBigUint64Arraycallbindbuffersstringlintflagagentdeep-cloneesmimetypesendpointbuffervalidationpromisesfast-deep-copycloudformationwordwrapargparsearrayssettingsdynamodbspeccloudtrailObject.isvpccolumnES2015jQuerysnsrecursivetoobjectidaccessibilityrouteReactiveExtensionslastECMAScript 2018CSSStyleDeclarationtestjsonargumentextendfixed-widthbrowserslistenvpolyfilljsdomtypeeditorstyleguideshellStreamcall-boundlimitbeanstalkdatarapidstabledomshimdiffparentjestreusetypanionObject.getPrototypeOfdeepstreamses-shimsECMAScript 2021ES7es2016multi-packageratelimitxtermcss-in-jsJSONMicrosoftposeprefixpropertystartArray.prototype.findLastIndexterminalreduxshebanghasOwnPropertyrmdirforEachhasOwnseskeyopenerstringifierfsnamemovefpsviewrdspyyamlprunepopmotionestreereact animation.envperformantpathweakmaphelperbyteLengthshamnumberTypedArraystreammimeInt8ArrayparentslibphonenumberUnderscorecommanderavacallbackregular expressiondotenveslintpluginaccessorWeakSetenvironmentsnegativeinstallhookslinewrapJSON-SchemaincludeslockfilecopyqueryeventscloudwatchfindLastfastifycharacterfilterwgetES5s3wrapextrahigher-orderiterationjapaneseerrormobiletaskcjksuperstructflagsArray.prototype.flatMapemitfindupes5processrobustcolouranimationchinesetypesdom-testing-library
5.6.95

1 year ago

5.6.97

1 year ago

5.6.96

1 year ago

5.0.30

1 year ago

5.0.31

1 year ago

5.0.32

1 year ago

5.0.33

1 year ago

5.0.34

1 year ago

5.0.35

1 year ago

5.0.36

1 year ago

5.0.37

1 year ago

5.0.38

1 year ago

5.0.39

1 year ago

5.2.59

1 year ago

5.2.58

1 year ago

5.2.57

1 year ago

5.2.56

1 year ago

5.2.55

1 year ago

5.4.79

1 year ago

5.2.54

1 year ago

5.6.99

1 year ago

5.2.53

1 year ago

5.6.98

1 year ago

5.2.52

1 year ago

5.0.24

1 year ago

5.0.25

1 year ago

5.0.26

1 year ago

5.0.27

1 year ago

5.0.28

1 year ago

5.0.29

1 year ago

7.6.101

1 year ago

7.6.102

1 year ago

6.6.100

1 year ago

5.5.95

1 year ago

5.3.72

1 year ago

5.3.71

1 year ago

5.5.93

1 year ago

5.3.70

1 year ago

6.6.101

1 year ago

5.5.94

1 year ago

5.5.91

1 year ago

5.5.92

1 year ago

5.5.90

1 year ago

5.3.79

1 year ago

5.3.78

1 year ago

5.3.77

1 year ago

5.3.76

1 year ago

5.1.52

1 year ago

5.3.75

1 year ago

5.1.51

1 year ago

5.3.74

1 year ago

5.1.50

1 year ago

5.3.73

1 year ago

5.3.61

1 year ago

4.0.19

1 year ago

5.6.100

1 year ago

8.7.109

1 year ago

8.7.108

1 year ago

8.7.107

1 year ago

8.7.106

1 year ago

8.7.105

1 year ago

8.7.104

1 year ago

4.0.21

1 year ago

4.0.20

1 year ago

5.1.49

1 year ago

5.1.48

1 year ago

5.1.47

1 year ago

5.1.46

1 year ago

5.3.69

1 year ago

5.1.45

1 year ago

5.3.68

1 year ago

5.1.44

1 year ago

5.3.67

1 year ago

5.1.43

1 year ago

5.3.66

1 year ago

5.1.42

1 year ago

5.3.65

1 year ago

5.1.41

1 year ago

4.0.23

1 year ago

5.5.89

1 year ago

5.3.64

1 year ago

4.0.22

1 year ago

5.3.63

1 year ago

5.3.62

1 year ago

4.0.24

1 year ago

8.7.112

1 year ago

8.7.111

1 year ago

8.7.110

1 year ago

7.7.102

1 year ago

7.7.104

1 year ago

7.7.103

1 year ago

4.0.16

1 year ago

4.0.15

1 year ago

4.0.18

1 year ago

4.0.17

1 year ago

4.0.14

1 year ago

4.0.13

1 year ago

5.4.83

1 year ago

5.2.60

1 year ago

5.4.84

1 year ago

5.4.81

1 year ago

5.4.82

1 year ago

5.0.40

1 year ago

5.0.41

1 year ago

5.4.80

1 year ago

5.4.89

1 year ago

5.4.87

1 year ago

5.4.88

1 year ago

5.4.85

1 year ago

5.4.86

1 year ago

5.2.61

1 year ago

4.0.12

1 year ago

4.0.11

1 year ago

4.0.9

1 year ago

4.0.8

1 year ago

4.0.10

1 year ago

4.0.7

1 year ago

3.0.7

1 year ago

3.0.6

1 year ago

3.0.5

1 year ago

3.0.4

1 year ago

3.0.3

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago