Document to Binary

Overview

You can use this Snap to transform document data into binary data. This Snap converts the value of the content key in the input document to binary data at the output view.

Snap views

View Description Examples of upstream and downstream Snaps
Input This Snap has at most one input view which is a document with a "content" key/value pair. The value of the "content" key should be a byte array, a string, or a character array.
Output The output view provides the binary data copied from the value of the "content" key in the input document. If the input document contains fields other than the "content" key/value pair, the additional input data is inserted into the header part of the output binary data. One use case would be to connect Salesforce Attachment Download Snap as an upstream Snap to download a file attached to an SObject record.
Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Legend:
  • Expression icon (): Allows using pipeline parameters to set field values dynamically (if enabled). SnapLogic Expressions are not supported. If disabled, you can provide a static value.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field / Field set Type Description
Label String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: Document to Binary

Example: Document_to_Binary
Encode or Decode Dropdown list Select if the content should be Base64 encoded or Base64 decoded or none (BYTE_ARRAY). The options are:
  • ENCODE_BASE64
  • DECODE_BASE64
  • DOCUMENT
  • NONE
  • BYTE_ARRAY

If the input content data has already been Base64-encoded and ENCODE_BASE64 is selected, the Snap does not encode the content again. Similarly, if the input "content" data has not been Base64-encoded and DECODE_BASE64 is selected, the Snap does not attempt to decode the content.

DOCUMENT serializes the document into a SnapLogic-specific JSON representation, which allows you to deserialize types such as Dates when read back using a Binary to Document Snap.

BYTE_ARRAY passes raw binary data (for example, a compressed .zip file). This is the safest way to convert such files between binary and document.

NONE uses the Snaplex's default platform-specific encoding (for example, plain text like .xml or .csv). Because this uses platform-specific encoding, it can vary between Snaplexes; therefore, do not use NONE when passing data between Pipelines that may run on different operating systems.

Default value: ENCODE_BASE64

Example: BYTE_ARRAY
Binary header properties Use this fieldset to specify the properties.
Note:
  1. You can access the properties in a binary document header in the expression properties of downstream Snaps. For example, a 'content-location' property added to the header in this Snap can be referenced in the File name property of a File Writer Snap with the expression: $['content-location'].

  2. If you configure the Snap to output a single binary document, the headers are computed from the first input document.
Expression String/Expression

Specify the value to use for a property in the binary header.

Default value: None

Target Path String Enter the target JSON path where the value from the expression will be written.

Default value: None

Example: $['content-location']
Snap execution Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Validate & Execute

Example: Execute only