Skip to main content

transform-string-stream

Running

❗ Remember to setup transform-hub locally or use the platform's environment for the sequence deployment.

Open two terminals and run the following commands:

The first terminal:

# go to 'transform-string-stream' directory
cd typescript/transform-string-stream

# install dependencies
npm install

# transpile TS->JS to dist/
npm run build

# deploy the Sequence from the dist/ directory, which contains transpiled code, package.json and node_modules
si seq deploy dist --args [\"Woogie \",\"Boogie\"]

# See output of Instance process
si inst output -

💡NOTE: Command deploy performs three actions at once: pack, send and start the Sequence. It is the same as if you would run those three commands separately:

si seq pack dist/ -o transform-string-stream.tar.gz    # compress 'transform-string-stream/' directory into file named 'transform-string-stream.tar.gz'

si seq send transform-string-stream.tar.gz # send compressed Sequence to STH, this will output Sequence ID

si seq start - --args '["Hello ", "Bye!"]' # start the Sequence with arguments, this will output Instance ID

The second terminal

# Send file to the Instance input steam
si inst input - name.txt
# the date will be read from the file 'name.txt'

or

# Send text to the Instance input steam
si inst input -
> Michael
# if file not given the data will be read from stdin

Output

# Now you should see "Hello John Bye" in output console
$ si inst output -
Hello Michael
Bye!

Check out the source on GitHub

Was it helpful?

Didn't find information needed?

Join our Scramjet Community on Discord, where you can get help from our engineers directly.