Skip to main content

How can I upload binary files?

· One min read
Jeremy Scott
Co-founder

Prior to version 3.1.0 of opscotch, you could only receive text content from the HTTP trigger i.e. json or text like. Version 3.1.0 now lets workflows receive raw binary uploads. The new context.getStream() call gives you direct access to the byte stream.

How to send a binary upload

Here is an example curl command to upload a binary file:

curl "http://localhost:11000/upload" \
-X POST \
-H "Content-Type: application/octet-stream" \
--binary-data '@a-binary-file'

In your workflow JavaScript processor:

let stream = context.getStream(); // ByteReader for the uploaded bytes
.. // continue processing the stream.