MCPcopy
hub / github.com/vercel/next.js / _write

Method _write

packages/next/src/server/lib/mock-request.ts:281–300  ·  view source on GitHub ↗
(
    chunk: Buffer | string,
    _encoding: string,
    callback: (error?: Error | null) => void
  )

Source from the content-addressed store, hash-verified

279 public _implicitHeader() {}
280
281 public _write(
282 chunk: Buffer | string,
283 _encoding: string,
284 callback: (error?: Error | null) => void
285 ) {
286 this.write(chunk)
287
288 // According to Node.js documentation, the callback MUST be invoked to
289 // signal that the write completed successfully. If this callback is not
290 // invoked, the 'finish' event will not be emitted.
291 //
292 // https://nodejs.org/docs/latest-v16.x/api/stream.html#writable_writechunk-encoding-callback
293 //
294 // If the stream was destroyed due to an error, we should propagate it
295 if (this.destroyed && this.errored) {
296 callback(this.errored)
297 } else {
298 callback()
299 }
300 }
301
302 public writeHead(
303 statusCode: number,

Callers

nothing calls this directly

Calls 2

writeMethod · 0.95
callbackFunction · 0.50

Tested by

no test coverage detected