This topic was automatically generated from Slack. You can find the original thread here.
I’m using the Dropbox download a file to tmp and it feeds back File successfully saved in "/tmp/undefined" In the results steps.download_file_to_tmp.$return_value.tmpPath is /tmp/tmp-8-JxjU7iZeLOxH but when I list the os contents of /tmp that’s not a location and future steps cannot access the file. Thoughts?
Based on the information you’ve provided, it seems like there’s a discrepancy between the path reported by the Dropbox “Download File to TMP” action and the actual location of the file in the /tmp directory. This can happen for various reasons, including issues with how the file path is being handled or reported within the workflow. To address this issue, you might want to explicitly specify the file path in your workflow to ensure consistency. Here’s a general approach you can take using Pipedream’s Node.js code step: 1. Use the Dropbox “Download File to TMP” action to download the file. Make sure you’ve correctly configured the action with the desired file path in Dropbox. 2. In the next step of your workflow, use a Node.js code step to access the file. You can use the path reported by the Dropbox action as a reference, but ensure you’re referencing the correct path. Here’s an example of how you might list the contents of the /tmp directory and access the downloaded file: import fs from 'fs'; export default defineComponent({ async run({ steps, $ }) { // List files in the /tmp directory const files = fs.readdirSync('/tmp'); console.log("Files in /tmp:", files); // Assuming the Dropbox action's return value is stored in steps.download_file_to_tmp // And that the tmpPath is correctly captured in the $return_value.tmpPath const filePath = steps.download_file_to_tmp.$return_value.tmpPath; console.log("File path from Dropbox action:", filePath); // Attempt to read the file content (replace with your specific logic) const fileContent = fs.readFileSync(filePath, 'utf8'); console.log("File content:", fileContent); // Return or process the file content as needed return fileContent; }, }); Please replace steps.download_file_to_tmp.$return_value.tmpPath with the actual reference to the path returned by your Dropbox download action. If you continue to experience issues with accessing the file, ensure that the file path is correctly reported and matches the actual location in the /tmp directory. You might also want to verify the file permissions and ensure that the file is not being moved or deleted by another process in your workflow. For more detailed guidance or if the issue persists, please visit Pipedream Support for further assistance.
import os
def list_files(directory):
for root, dirs, files in os.walk(directory):
for file in files:
print(os.path.join(root, file))
directory_path = '/tmp'
list_files(directory_path)