Function: getBatchStreamFormatter()
getBatchStreamFormatter(): (
index
,string
) =>string
Format a batch response as a line-delimited JSON stream
that the unstable_httpBatchStreamLink
can parse:
Example
ts
const formatter = getBatchStreamFormatter();res.send(formatter(1, 'response #2'));res.send(formatter(0, 'response #1'));res.send(formatter.end());
ts
const formatter = getBatchStreamFormatter();res.send(formatter(1, 'response #2'));res.send(formatter(0, 'response #1'));res.send(formatter.end());
Expected format:
json
{ "1": "response #2", "0": "response #1" }
json
{ "1": "response #2", "0": "response #1" }
Returns
(
index
,string
):string
Parameters
Parameter Type index
number
string
string
Returns
string
Source
packages/core/dist/http/batchStreamFormatter.d.ts:21
end
end
Source
packages/core/dist/http/batchStreamFormatter.d.ts:20
Generated using TypeDoc and typedoc-plugin-markdown