How to Download a File from an API and Upload It to Another API in a Pipedream Workflow Without Using 'tmp' Directory or File Store?

You too! :wave:

Zapier does have a concept of “file handle” that can be passed around between steps (instead of referencing a file path).

Is that what you have in mind?

But a file handle is effectively just a pointer to a file path. :man-shrugging:

It just hides the filesystem from the end user.

So instead of seeing /tmp/my_file.ext, you see $my_file_v543763r12c23t34t32f32d23.

But it’s effectively the same thing. :man-shrugging:

Ah, I see. I think what I have in mind is something more like, being able to access files in the same way that we can access output data as $return_value from previous steps, and then using that directly in API request steps, rather than having to access it within Node code blocks

Right. That is exactly how it works when a step is natively implemented in Pipedream.

A download step will return the /tmp path of the file.
And an upload step will take that value as a prop (to specify which file to upload).

And then:

If the apps that you use do not natively support this, just open requests on GitHub!

I see! I’ll definitely do that after the weekend. Thank you for your help again!

Hi, happy Monday :slightly_smiling_face: I’ve implemented the code to download and upload files using Node code steps, however the results are really inconsistent. I’m frequently getting this error by the time I get to the step that uploads the file to a different API: ENOENT: no such file or directory, open '/tmp/<my_filename_here>.pdf'

Occasionally, it works, though. And it works every time when I run the workflow in build mode.

Is there a reason this might happen?

I ran a Python code block immediately after storing the RingCentral file in tmp to output the contents of tmp and the file is there - but later in the workflow, when I upload the file to another app, I also use the same Python code to output the contents of tmp and it looks like it’s been wiped somehow. The file isn’t there anymore.

This doesn’t happen in the builder, just in the actual live deployment.

I realized tmp is only accessible within the segment; so I’m using the file store instead and it’s working now :slightly_smiling_face: