Skip to content
Documentation
1.0.0-beta.10 · latest

Opaque binary proxy

Source e69e4b6f1381 · Published v1.0.0-beta.10

Returns an origin response directly. The binary or streaming body stays host-owned and is never decoded or copied into user scope.

import { Pulse } from '@pulse-compute/pulse'
const app = new Pulse({ auto: true })
app.get('/archive', async (ctx) => {
return ctx.fetch('https://assets.example.com/archive.bin')
})
export default app
import { defineConfig } from '@pulse-compute/pulse'
export default defineConfig((_scope) => ({
pulse: {
entry: 'src/index.ts',
tests: 'tests/pulse.harness.ts',
defaultProfile: 'local',
strict: true,
},
local: {
host: 'fastly',
target: 'native',
outDir: 'dist',
dev: {
fetches: {
'https://assets.example.com/archive.bin': {
opaque: true,
status: 206,
headers: [
['content-type', 'application/octet-stream'],
['x-part', 'one'],
['x-part', 'two'],
],
chunks: ['opaque-example'],
},
},
},
fastly: {
bindings: {
backends: {
'https://assets.example.com': 'assets_backend',
},
dynamicBackends: false,
},
build: { name: 'pulse-opaque-proxy-example' },
},
},
}))

Generated from the executable test harness below; these are tested requests or event frames, not an exhaustive application specification. Expected errors and emitted events are included; fixtures and provider setup remain in the harness.

RequestExpected response
pass-through
GET /archive
{"status":206,"bodyClass":"opaque","headers":[["x-part",["one","two"]]]}

The selected profile is local; this checked excerpt identifies its target, provider and recognized capabilities. Paths, hashes and additional inspection fields are omitted.

Terminal window
npm run inspect -- --json
{
"status": "ok",
"project": {
"target": "native"
},
"provider": {
"id": "fastly"
},
"compiler": {
"capabilities": [
"fetch",
"response.text"
]
}
}

Check this project and its local toolchain before execution. This selected result is verified by the documentation gate; another machine may report different prerequisite checks.

Terminal window
npm run doctor -- --json
{
"status": "passed",
"summary": {
"warnings": 0,
"failed": 0
}
}

Build once into a separate directory, then replay the retained artifact without running or rebuilding the application. This checked excerpt accounts for registered handlers in the build evidence; it is not runtime request coverage.

Terminal window
npm run build -- --out .pulse-docs-build
npm exec -- pulse report --artifact .pulse-docs-build/pulse-build.json --json
{
"kind": "pulse.application-report",
"reportVersion": 1,
"analytics": {
"coverage": {
"handlers": {
"expected": 1,
"observed": 1,
"reason": null,
"status": "complete"
}
}
}
}

Optional offline HTML uses the same retained evidence:

Terminal window
npm exec -- pulse report --artifact .pulse-docs-build/pulse-build.json --html

Review reports before sharing. Missing, stale or incompatible evidence is an error; timings, paths and hashes are not presented as stable output.

Interactive report captured from this example at source e69e4b6f1381. Build evidence describes this captured build, not a runtime guarantee.

Open full report · Capture provenance

Terminal window
pulse doctor
pulse inspect
pulse test
pulse dev
pulse build

The documented test result below is executed by the documentation gate.

Fastly builds produce a verified .pulse-docs-build/bin/main.wasm. Configured tests execute through the local-conformance runtime; compiled-target execution remains in the explicit reality profile.

Terminal window
pulse test --json
{
"status": "passed",
"provider": "fastly",
"summary": {
"total": 1,
"passed": 1,
"failed": 0
},
"cases": [
{
"name": "pass-through",
"status": "passed",
"response": {
"status": 206
}
}
]
}
export default {
cases: [
{
name: 'pass-through',
request: { path: '/archive' },
fetches: {
'https://assets.example.com/archive.bin': {
opaque: true,
status: 206,
headers: [
['content-type', 'application/octet-stream'],
['x-part', 'one'],
['x-part', 'two'],
],
chunks: ['opaque-example'],
},
},
expect: {
status: 206,
bodyClass: 'opaque',
headers: { 'x-part': ['one', 'two'] },
},
},
],
}

For build settings, see Native build optimization.

ArtifactDefault build
Portable guest canonical-native.wasm2.2 KiB (2,205 bytes)
Deployable Fastly module bin/main.wasm35.8 KiB (36,637 bytes)

The executable documentation gate rebuilds and measures these default artifacts. Measured with Node 24.18.0 and lockfile-pinned AssemblyScript 0.28.18. The provider artifact includes Fastly transport handling, deadlines, the complete send-error detail record, and bounded transport diagnostics through WASI stdout. The clock and stdout imports are checked explicitly. These are uncompressed on-disk sizes, not transfer sizes or platform limits.