BundleProtocol
Protocol handler for serving files from bundle sources.
Protocol handler for serving files from bundle sources.
Serves web resources from .wvb bundle files, supporting:
- GET and HEAD HTTP methods
- HTTP Range requests for streaming
- Content-Type and custom HTTP headers
Constructor
new BundleProtocol(source: BundleSource);Prop
Type
Methods
Prop
Type
Examples
const source = new BundleSource({
builtinDir: './bundles/builtin',
remoteDir: './bundles/remote',
});
const protocol = new BundleProtocol(source);
// Handle a request
const response = await protocol.handle('get', 'bundle://app/index.html');
console.log(`Status: ${response.status}`);
console.log(`Content-Type: ${response.headers['content-type']}`);constructor
const source = new BundleSource({
builtinDir: './bundles',
remoteDir: './remote',
});
const protocol = new BundleProtocol(source);handle
// GET request
const response = await protocol.handle('get', 'bundle://app/index.html');
if (response.status === 200) {
console.log(response.body.toString('utf-8'));
}// Range request for streaming
const response = await protocol.handle('get', 'bundle://app/video.mp4', { Range: 'bytes=0-1023' });
console.log(`Status: ${response.status}`); // 206 Partial Content