http2.getPackedSettings([settings])


返回 Buffer 实例,其中包含 HTTP/2 规范中指定的给定 HTTP/2 设置的序列化表示。 这旨在与 HTTP2-Settings 标头字段一起使用。

const http2 = require('http2');

const packed = http2.getPackedSettings({ enablePush: false });

console.log(packed.toString('base64'));
// 打印: AAIAAAAA

Returns a Buffer instance containing serialized representation of the given HTTP/2 settings as specified in the HTTP/2 specification. This is intended for use with the HTTP2-Settings header field.

const http2 = require('http2');

const packed = http2.getPackedSettings({ enablePush: false });

console.log(packed.toString('base64'));
// Prints: AAIAAAAA