Version
26.5.0
Platform
Subsystem
No response
What steps will reproduce the bug?
const zlib = require('node:zlib');
const dict = Buffer.from('the quick brown fox '.repeat(4));
const ab = dict.buffer.slice(dict.byteOffset, dict.byteOffset + dict.byteLength);
console.log(zlib.zstdCompressSync(dict, { dictionary: dict }).length); // 16 (dict used)
console.log(zlib.zstdCompressSync(dict, { dictionary: ab }).length); // 63 (dict ignored)
console.log(zlib.zstdCompressSync(dict).length); // 63 (no dict)
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
An ArrayBuffer dictionary is honored.
Both frames should be 16.
What do you see instead?
The ArrayBuffer is silently dropped and zstd compresses with no dictionary (63).
Additional information
According to the docs this may not be a bug(the Zstd dictionary option is documented as {Buffer} only).
But deflate/inflate and Brotli accept an ArrayBuffer, so it would be nice to align Zstd with them.
Version
26.5.0
Platform
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
An ArrayBuffer dictionary is honored.
Both frames should be 16.
What do you see instead?
The ArrayBuffer is silently dropped and zstd compresses with no dictionary (63).
Additional information
According to the docs this may not be a bug(the Zstd dictionary option is documented as {Buffer} only).
But deflate/inflate and Brotli accept an ArrayBuffer, so it would be nice to align Zstd with them.