Skip to main content

A Simple Function

Scramjet's Sequence is a simple function that calls other functions in an asynchronous way. It's wrapped up in a tar.gz file and sent to Scramjet's Transform Hub.
In this example the main function calls the getPageFromAPI() function and returns a string value.

async function getPageFromAPI() {
return "Your result";
}

module.exports = async function (_stream, timeout = 10000) {
await new Promise(res => setTimeout(res, timeout));
return getPageFromAPI();
}

To create a Sequence, define a function that encapsulates the data processing task you wish to solve. Bundle the function with dependencies into a deployable package (tar.gz). Upload the package to Scramjet Transform Hub or Cloud Platform for deployment. The Sequence will be stored and ready for execution. In the next section we will demonstrate how to simply pack and send a Sequence.

Was it helpful?

Didn't find information needed?

Join our Scramjet Community on Discord, where you can get help from our engineers directly.