Writing files to temp using a value from steps

Hello, I am trying to write a file to temp in a Node step - I want to read the file name from a previous step but it doesn’t substitute the value and creates a file called “{{steps.get_file.$return_value.file.name}}”

fs.createWriteStream(‘/tmp/{{steps.get_file.$return_value.file.name}}’)

Thanks a lot!

Hi! Can you share a screenshot of your configuration?

Hello Andrew, thanks here you go:

Thanks for sharing the screenshot!

In line 12, the path is being evaluated as a string (inside single quotes), so try changing to:

fs.createWriteStream(`/tmp/${steps.get_file.$return_value.file.name}`)

The above is using template literals, so it’ll evaluate whatever is inside ${} as JS code