MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / write

Method write

modules/crypt/ssl/session_419.js:211–229  ·  view source on GitHub ↗
(s, data, options)

Source from the content-addressed store, hash-verified

209 }
210 }
211 write(s, data, options) {
212 if (options?.more) {
213 this.#buffer ??= new SSLStream(undefined, options.byteLength);
214 this.#buffer.writeChunk(data);
215 return Math.max(0, s.writable - this.#buffer.bytesAvailable - 32);
216 }
217 if (this.#buffer) {
218 this.#buffer.writeChunk(data);
219 data = this.#buffer.getChunk();
220 this.#buffer = undefined;
221 }
222
223 if (data.byteLength > maxFragmentSize)
224 throw new Error("too large");
225 this.startTrace("packetize");
226 const packet = recordProtocol.packetize(this, recordProtocol.application_data, data);
227 s.writable = s.write(packet);
228 return Math.max(0, s.writable - 32);
229 }
230 close(s) {
231 this.startTrace("packetize");
232 const packet = SSLAlert.packetize(this, 0, SSLAlert.close_notify);

Callers

nothing calls this directly

Calls 5

startTraceMethod · 0.95
maxMethod · 0.80
writeMethod · 0.65
writeChunkMethod · 0.45
getChunkMethod · 0.45

Tested by

no test coverage detected