I need a help. I am using python script here. I wanted to add output stream relationship result of ExecuteStreamCommand processor into original flow file in nifi
check Output Destination Attribute
property - if it's empty then all what you print/write to STDOUT will go to flow file content
in python you could write to stdout using simple print:
print("hello world") # this will go to file content
or sys module:
import sys
sys.stdout.write( "Hello Standard Output!\n" )
to append flowfile content - you have to copy from stdin to stdout current file content and then write something new
import sys
#write current file content (use buffer for binary mode - python3+
for chunk in iter(lambda: sys.stdin.buffer.read(4096), b''):
sys.stdout.buffer.write(chunk)
sys.stdout.buffer.flush()
#append new data
sys.stdout.write('new data at the end...')