This topic was automatically generated from Slack. You can find the original thread here.
Is it possible to save files to the /tmp directory from a source/trigger in Pipedream?
This topic was automatically generated from Slack. You can find the original thread here.
Is it possible to save files to the /tmp directory from a source/trigger in Pipedream?
Yes, it is possible to save files to the /tmp directory from a source/trigger in Pipedream. You have full read-write access to the /tmp directory within a workflow, with a size limit specified by process.env.TMP_SIZE_LIMIT. Here’s an example of how you can download an image to the /tmp directory: import stream from "stream"; import { promisify } from "util"; import fs from "fs"; import got from "got"; const pipeline = promisify(stream.pipeline); await pipeline( got.stream(steps.trigger.event.body.image.url), fs.createWriteStream(`/tmp/${steps.trigger.event.body.image.filename}`) ); This code uses the got library to stream an image from a URL and saves it to the /tmp directory using Node.js’s fs module. You can adapt this example to save other types of files as needed. For more details, you can refer to the Pipedream documentation on working with files.
Can you verify that this is true? I’m having trouble accessing files in a workflow that were saved to /tmp in the trigger. I wondered if it might be because triggers can be used for multiple workflows, but the /tmp directory is tied to one workflow.
Yea your interpretation is basically right. Sources run as independent deployed lambdas from workflows, so workflows don’t have access to tmp storage of sources.