Altova FlowForce Server 2025 Advanced Edition

The create-file function allows you to store stream content in a file that you may need to use in the future. Files created with the help of the create-file function are not temporary. Such files belong to the user and not to FlowForce.

 

The create-file function is similar to the as-file function in that it creates the specified target file with the specified stream content, but create-file does not create any temporary files. Use /system/create-file to store stream content that you intend to keep. Use as-file to pass the stream content as a file to some program. This might be a temporary file managed by FlowForce.

 

The source expression (see screenshot below) can be anything that returns a stream. You can use anything you can pass to the as-file function. For example, you could use the following options:

 

stdout(result), stderr(result), result(result, name, index) get streams out of step results;

as2-mdn-serialize(mdn) produces a serialized version of an MDN;

mime-flatten(stream) produces a message/rfc822 stream from another by prefixing it with its MIME headers;

mime-multipart(string, stream*) produces a MIME multi-part structure as a stream;

stream-open(filename, contenttype) opens a file on disk;

empty-stream() produces a zero-length stream;

stream-from-string(text, encoding, content-type) encodes a string value into a stream.

 

Parameters

Name

Type

Description

Target file

string

Mandatory parameter. The name of the file to which stream content will be saved.

Source stream

stream

Mandatory parameter. Stream content that you wish to save to a file.

Overwrite target

boolean

Optional parameter. Set this parameter to true if you want to overwrite destination files with the same names. The default value is false.

Working directory

string

Optional parameter. Specifies the path to the directory where the target file will be saved.

Abort on error

boolean

Optional parameter. This parameter determines the outcome of a job in which an error has occurred. If the Abort on error parameter is true, job execution will be terminated. If the Abort on error parameter is false, FlowForce Server will ignore errors and continue job execution. The default value is true.

 

Example

The screenshot below illustrates the create-file function. Our goal is to create a file called CreateTest.txt and save it on the desktop. We are going to use the stream-from-string function, which encodes a string value into a stream. As a result, we will see our new CreateTest.txt file containing the string MyFileContent.

 

Note:To run the job, set a trigger and/or run the job as a service.

FFS_BuiltinFunc_Systems_create-file

 

© 2018-2024 Altova GmbH