Skip to main content

Stream Techniques

The Stream Techniques component is designed to provide small examples of useful techniques for different ways to streaming data using the STREAM Library . It includes five main strategies:

  1. Stream from a string to a file - Streams data from a string and streams it to a file.

  2. Stream from file to file - Streams in data from an existing file into a string and creates a copy by streaming it to a new file.

  3. Stream from a pipe - Executes an external command (pipe) and streams command output and convert to a string.

  4. Stream to a pipe - Streams a Lua string to a pipe, transforms the data (e.g., uppercase), and streams the result back from pipe. (PowerShell example)

  5. Stream to/from a socket - Streams data to and from a TCP socket. (Requires a local TCP echo server)

The main() function runs all five demos sequentially and logs results for later inspection.

Component Setup:

Import the Stream Techniques component

Click "Edit" on the component card to open the Translator and view the script

Once in the Translator, see how the various streaming techniques are used.

In order to run the 5th example, you will need to set up a local TCP echo server, explained in the comments of main.lua. If you do not want to run this example, you can comment it out.