protobuf

package module
v0.0.0-...-5c76619 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

xk6-protobuf

A k6 extension for decoding and encoding proto files. Built using xk6.

Setup and Running

Follow these steps to set up and run the K6 benchmark with Protobuf support:

1. Install go

Installing Go toolchain

2. Export the Go PATH

Add the Go binary directory to your system's PATH environment variable:

export PATH=$(go env GOPATH)/bin:$PATH
2. Install xk6

Install the latest version of xk6:

go install go.k6.io/xk6/cmd/xk6@latest
3. Build

Build the K6 binary with the xk6-protobuf extension:

xk6 build v1.8.2 --with github.com/traveltime-dev/xk6-protobuf@latest

If you want to build it locally, then clone this repository and use:

xk6 build --with xk6-protobuf=.
4. Run

Run the K6 benchmark using the generated binary and the protobuf benchmark file:

./k6 run {proto-benchmark-file}.js

Replace {proto-benchmark-file}.js with the actual file name of your protobuf benchmark script.

Examples

Command to run examples: ./k6 run example/codec.js

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProtoFile

type ProtoFile struct {
	// contains filtered or unexported fields
}

func (*ProtoFile) Decode

func (p *ProtoFile) Decode(decodedBytes []byte) string

func (*ProtoFile) Encode

func (p *ProtoFile) Encode(data string) string

func (*ProtoFile) EncodeBase64

func (p *ProtoFile) EncodeBase64(data string) string

EncodeBase64 returns the encoded message as base64. Encode's raw bytes only survive direct use (e.g. http.post); any JS-side round-trip such as SharedArray storage corrupts them, so store this and b64decode per use.

type Protobuf

type Protobuf struct{}

func (*Protobuf) Load

func (p *Protobuf) Load(protoFilePath, lookupType string, importPaths ...string) ProtoFile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址