Access "Directory" and "File Name" properties of binary file (get request)

Hello,

I make a GET request to an URL to download a video. The Response Format is file so it output a “data” file with Directory and File name properties.

I want to use this file in a node to upload this video as Instagram Reel.
But, I can’t find a way to use this file in my Instagram API Node.
How can I access the “Directory” and “File Name” properties of my Get Request Node ?

{{ $node[\"Download Video\"].json[\"data\"][\"directory\"] }}/{{ $node[\"Download Video\"].json[\"data\"][\"fileName\"] }} return undefined.

loom video: Arc - Conversion de diapositives - 10 June 2024 | Loom

Please share your workflow

Share the output returned by the last node

n8n version: Version 1.39.1
Database (default: SQLite): Postgres
Running n8n via (Docker, npm, n8n cloud, desktop app): N8N Cloud (Railway)
Operating system: MacOS.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Theovogg, you can access the binary data values in the expanded view and reconstruct the video url. To do that, you can click on the expand icon:

CleanShot 2024-06-10 at 16.13.40

Then find the id of the binary data

and add the server domain where your n8n is hosted. If you’re using n8n Cloud, then it’ll be https://<your-username>.n8n.cloud/rest/

Hope that helps!

1 Like

OK, got it thanks!

But it seems like the URL isn’t working. I got a 404 not found error while trying to access it.

Any idea why ? And what should I try ?

Also I don’t have ID :

Hi @Theovogg, can you maybe try using the $binary.data.id instead of the directory or the fileName, so like this:

https://n8n-bonfire.up.railway.app/rest/binary-data?id={{ $binary.data.id }}

I’d love to but I don’t have access to id.

UP. Please I still need help on this!

Hi @Theovogg, so it turns out reconstructing the url of the binary data won’t help in terms of what you’re trying to do.

By default n8n keeps the binary file in memory not on disk so there is no local directory, hence there’s no $binary.data.id in your case. But even if you were able to reconstruct the url to your local directory, there’s no way to post the file from the directory to an external server so it won’t help.

To solve your issue, you would need to upload the video file you downloaded to another storage service. You can do this by choosing the “binary data” option to send in the second HTTP Request node. The binary file name should be the file name from the previous Download video node, by default it will be data. Upload it to a storage service like s3 that has a public url for the video file, which Instagram can then cURL. Then add another node to make the POST request to Instagram to upload your video.

Hope that makes sense and sorry for making misleading suggestions in my earlier replies!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.