MCPcopy Index your code
hub / github.com/brianc/node-postgres / write

Method write

packages/pg-cloudflare/src/index.ts:85–105  ·  view source on GitHub ↗
(
    data: Uint8Array | string,
    encoding: BufferEncoding = 'utf8',
    callback: (...args: unknown[]) => void = () => {}
  )

Source from the content-addressed store, hash-verified

83 }
84
85 write(
86 data: Uint8Array | string,
87 encoding: BufferEncoding = 'utf8',
88 callback: (...args: unknown[]) => void = () => {}
89 ) {
90 if (data.length === 0) return callback()
91 if (typeof data === 'string') data = Buffer.from(data, encoding)
92
93 log('sending data direct:', data)
94 this._cfWriter!.write(data).then(
95 () => {
96 log('data sent')
97 callback()
98 },
99 (err) => {
100 log('send error', err)
101 callback(err)
102 }
103 )
104 return true
105 }
106
107 end(data = Buffer.alloc(0), encoding: BufferEncoding = 'utf8', callback: (...args: unknown[]) => void = () => {}) {
108 log('ending CF socket')

Callers 15

endMethod · 0.95
copy-stream.jsFile · 0.80
copy-from.jsFile · 0.80
async-workflow.jsFile · 0.80
requestSslMethod · 0.80
startupMethod · 0.80
_sendMethod · 0.80
flushMethod · 0.80
endMethod · 0.80
buffer-list.jsFile · 0.80
test-helper.jsFile · 0.80
runMethod · 0.80

Calls 2

callbackFunction · 0.85
logFunction · 0.70

Tested by 1

parseBuffersFunction · 0.64