Why Can't I Access the File in the File Store in My Pipedream Workflow?

This topic was automatically generated from Slack. You can find the original thread here.

Hi Folks

I’m building my first, simple workflow in PD.
Involves data in from Jotform, lodge that data in a data structure (might use it later in other jotforms) and then that data into 1 or more MS Word templates – then a quick existing directory check in dropbox and an upload of the files (with slack sending me a DM once the cycle has run)

Mostly working……… which is awesome
BUT
So, my problem – I decided using the file store option would be simple (self-contained etc etc) and probably less prone to issues (could be wrong about that……) and can not for the life of me get my code to access the file in the file store – dozens of 404’s later, and having checked the URL a dozen times, I’m stumped (could just abandon file store and use dropbox, but like the all in one concept and am sure it’s just me being a noob……………

Here is my code snippet as relevant:

const fileApiUrl = “https://api.pipedream.com/projects/proj_ZpsrroA/files?file=%2FPDall.docx”; // Root-level file
console.log(Step 5: Fetching file from URL: ${fileApiUrl});

File reference is correct (click and open) as:
https://api.pipedream.com/projects/proj_ZpsrroA/files?file=%2FPDall.docx

Any help would be much appreciated

Thank you

how to fetch a file from the file store in node.js?

To fetch a file from the File Store in Node.js within a Pipedream workflow, you can use the $.files helper. Here’s a basic example of how you can download a file from the File Store to the /tmp directory: export default defineComponent({ async run({ steps, $ }) { // Specify the path of the file in the File Store const filePath = "your-file-path"; // Download the file to the /tmp directory const localFilePath = await $.files.download(filePath, "/tmp"); // Return the local file path return localFilePath; }, }); ### Explanation - filePath: Replace "your-file-path" with the actual path of the file in your File Store. - $.files.download: This method downloads the specified file from the File Store to the /tmp directory. - localFilePath: This variable will hold the path to the downloaded file in the /tmp directory. For more details, you can refer to the File Stores Node.js Reference.

how to fetch file from dropbox to work on?