On this Page

Snap type:Transform
Description:

This Snap merges multiple binary documents into a single MIME "multipart" stream.

Input & Output

  • InputBinary documents to be put together into a single binary output document

  • Output: A "multipart" binary document that contains the input documents.
Prerequisites:None.
Limitations and Known Issues:

None.

Configurations:

Account & Access

Accounts are not used with this Snap.

Views

InputThis Snap has exactly one binary input view.
OutputThis Snap has exactly one binary output view.
ErrorThis Snap has at most one document error view and produces zero or more documents in the view.


Troubleshooting:The section describes typical issues you may encounter while using this Snap, and instructions on how to work around them:

Settings

Label


Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Binary Header PropertiesThe binary output document header can be modified by specifying properties in this table property. The "expression" column computes the value to insert and the "Target Path" is a JSONPath where the value should be set in the header. The headers are initially populated with the headers from the parts in the stream. These properties allow you to carryover values from the original multipart input document to the binary output documents.
Group Identifier

This property can be used to generate multiple binary output documents.  By default, the Snap generates a single binary document containing parts for all of the input documents. If you need to generate multiple binary output documents, you can use this property to close out the previous document and start a new one. The property is treated as an identifier for each "group". The value of the identifier isn't meaningful to the Snap. It is only looking to see if the values changes from one input document to the next. When the value does change, then a new output document is started.


Examples



Multipart Write Snap Using the JSON Format Data

In the following pipeline, the Multipart Writer Snap reads the data in a JSON format and displays the result as a multipart output stream.

The JSON Generator Snap passes the data to the Multipart Writer Snap.

In the Multipart Writer Snap, the Group Identifier allows us to create seperate documents with a specific value (here $num) as per the requirement.

If the Group Identifier is $['content-type'], then the output document would have all the files under a single Group Identifier. 

Successful execution of the pipeline displays the output shown below:

The output has two previews with two different Group Identifiers: one for the $num value 1 and one for $num value 2.



Multipart Write Snap Using the Raw Data from a REST Client

In the below use case, multiple files are posted using the content type as rawdata through the REST client:


A triggered task has been created for the specific multipart Writer pipeline. It takes the cloud URL from the Manager and sends the REST pipeline request from the Postman client: 


The Snap receives the request from the REST client and displays the output as a multipart output stream:


The File Writer Snap uses the expression "multipart"+Date.now()+".json", so the output displays all the documents created at intervals.

The successful execution of the pipeline displays the output files as shown below:


Download the sample pipeline