MCPcopy Create free account
hub / github.com/mscdex/ssh2 / finalize

Method finalize

lib/protocol/zlib.js:188–204  ·  view source on GitHub ↗
(payload, force)

Source from the content-addressed store, hash-verified

186 }
187
188 finalize(payload, force) {
189 if (this._protocol._kexinit === undefined || force) {
190 const output = this._zlib.writeSync(payload, true);
191 const packet = this._protocol._cipher.allocPacket(output.totalLen);
192 if (output.push === undefined) {
193 packet.set(output, 5);
194 } else {
195 for (let i = 0, p = 5; i < output.length; ++i) {
196 const chunk = output[i];
197 packet.set(chunk, p);
198 p += chunk.length;
199 }
200 }
201 return packet;
202 }
203 return payload;
204 }
205}
206
207class PacketWriter {

Callers

nothing calls this directly

Calls 2

writeSyncMethod · 0.80
allocPacketMethod · 0.45

Tested by

no test coverage detected