Stream to string

Type conversion Pure
Stream to string
Input(Input stream)
Value
Charset(Character set) UTF-8

Description

Pure function reading a stream fully and returning its contents as a string. Uses the charset from the stream's content-type hint when set; otherwise falls back to the selected charset.

When to use

Use Stream to string to buffer an input stream into a string so that string nodes can operate on it. The most common use case is reading the body of an incoming HTTP request produced by Receive HTTP, or reading an HTTP response body from HTTP request. Choose the charset that matches the upstream source; UTF-8 is appropriate for the vast majority of web payloads.

Pins

Input pins

Pin Type Default Notes
Input Input stream The input stream to read. The stream is consumed fully and closed after reading.
Charset Character set UTF-8 Fallback charset used when the stream does not carry a content-type hint. UTF-8 is correct for most JSON, XML, and plain-text payloads.

Output pins

Pin Type Notes
Value string The full contents of the stream decoded as a string.

Example

Read an HTTP request body and log it for debugging. Wire the Body output of Receive HTTP into the Input of Stream to string (Charset set to UTF-8). Feed the Value output into the Message input of Log message. This is typically the first step after Receive HTTP when you need to inspect or parse the request payload.

See also