MCPcopy Index your code
hub / github.com/CodeGenieApp/serverless-express / getString

Function getString

src/response.js:10–20  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

8const HEADERS = Symbol('Response headers')
9
10function getString (data) {
11 if (Buffer.isBuffer(data)) {
12 return data.toString('utf8')
13 } else if (typeof data === 'string') {
14 return data
15 } else if (data instanceof Uint8Array) {
16 return new TextDecoder().decode(data)
17 } else {
18 throw new Error(`response.write() of unexpected type: ${typeof data}`)
19 }
20}
21
22function addData (stream, data) {
23 if (Buffer.isBuffer(data) || typeof data === 'string' || data instanceof Uint8Array) {

Callers 1

constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…