Files
NapCatQQ/.pnpm-store/v3/files/bf/e3da799933b1603ba6191f309a837496236278d22f44c5cad59189c7802f4907c388a0d70684b695750e962b322ec3d9195534321e5dd4f7a7bc6e7de2903a
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

39 lines
958 B
Plaintext

'use strict';
const fs = require('fs');
const zlib = require('zlib');
const utils = require('../utils');
const streamifier = require('streamifier');
class GzipUncompressStream extends zlib.Unzip {
constructor(opts) {
opts = opts || {};
super(opts.zlib);
const sourceType = utils.sourceType(opts.source);
if (sourceType === 'file') {
const stream = fs.createReadStream(opts.source, opts.fs);
stream.on('error', err => this.emit('error', err));
stream.pipe(this);
return;
}
if (sourceType === 'buffer') {
const stream = streamifier.createReadStream(opts.source, opts.streamifier);
stream.on('error', err => this.emit('error', err));
stream.pipe(this);
return;
}
if (sourceType === 'stream') {
opts.source.on('error', err => this.emit('error', err));
opts.source.pipe(this);
}
// else: waiting to be piped
}
}
module.exports = GzipUncompressStream;