Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Brotli encoder and decoder for hapi.js.
Lead Maintainer - Gil Pedersen
npm install brok
Registration with custom quality default:
'use strict';
const Hapi = require('@hapi/hapi');
const Brok = require('brok');
const server = new Hapi.Server({ port: 3000, compression: { minBytes: 1 } });
const provision = async () => {
server.route({
method: 'GET',
path: '/fetch',
handler() {
return 'ok';
}
});
await server.register({
plugin: Brok,
options: {
compress: { quality: 3 }
}
});
await server.start();
console.log('Server running at:', server.info.uri);
};
provision();
Once registered, brok enables the server to negotiate and handle the "br"
encoding for
compressible responses and uploads.
brok accepts the following registration options:
compress
- compression settings.
Set to false
to disable response compression using brotli.
quality
- used to adjust compression speed vs quality from 0 to 11.
Defaults to 5
.mode
- compression mode.
Available values:
'generic'
- default compression mode. Default value.'text'
- optimize for UTF-8 formatted text input.decompress
- if true
, also register the encoding for decompressing incoming payloads.
Defaults to false
.Route specific settings can be set using br
object in the compression
config. Eg.
server.route({
method: 'GET',
path: '/text',
options: {
handler() {
return 'hello!';
},
compression: {
br: { mode: 'text' }
}
}
});
FAQs
Brotli encoder and decoder for hapi.js
We found that brok demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.