mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

Some checks are pending
Coverage Linux (without intl) / coverage-linux-without-intl (push) Waiting to run
Coverage Linux / coverage-linux (push) Waiting to run
Coverage Windows / coverage-windows (push) Waiting to run
Test and upload documentation to artifacts / build-docs (push) Waiting to run
Linters / lint-addon-docs (push) Waiting to run
Linters / lint-cpp (push) Waiting to run
Linters / format-cpp (push) Waiting to run
Linters / lint-js-and-md (push) Waiting to run
Linters / lint-py (push) Waiting to run
Linters / lint-yaml (push) Waiting to run
Linters / lint-sh (push) Waiting to run
Linters / lint-codeowners (push) Waiting to run
Linters / lint-pr-url (push) Waiting to run
Linters / lint-readme (push) Waiting to run
Notify on Push / Notify on Force Push on `main` (push) Waiting to run
Notify on Push / Notify on Push on `main` that lacks metadata (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Fixes: https://github.com/nodejs/node/issues/48412 PR-URL: https://github.com/nodejs/node/pull/52100 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
29 lines
796 B
JavaScript
29 lines
796 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const zlib = require('zlib');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const file = fixtures.readSync('person.jpg');
|
|
const chunkSize = 16;
|
|
const compress = new zlib.ZstdCompress();
|
|
|
|
const chunk = file.slice(0, chunkSize);
|
|
const expectedFull = Buffer.from('KLUv/QBYgAAA/9j/4AAQSkZJRgABAQEASA==', 'base64');
|
|
let actualFull;
|
|
|
|
compress.write(chunk, function() {
|
|
compress.flush(function() {
|
|
const bufs = [];
|
|
let buf;
|
|
while ((buf = compress.read()) !== null)
|
|
bufs.push(buf);
|
|
actualFull = Buffer.concat(bufs);
|
|
});
|
|
});
|
|
|
|
process.once('exit', function() {
|
|
assert.deepStrictEqual(actualFull.toString('base64'), expectedFull.toString('base64'));
|
|
assert.deepStrictEqual(actualFull, expectedFull);
|
|
});
|