This topic was automatically generated from Slack. You can find the original thread here.
I’m getting this when I call this code below to get a file and work with it in a workflow…. Basically toFile() as mentioned here isn’t working File Stores (pipedream.com)
If I understand we are to use the get_url to download the file from the url, how does the put_url work to update the file?
To achieve what I showed on the screenshot, I remove the toFile() bit of the above, then I get the get_url and put_url. toUrl() works to return the get_url, but toFile() returns undefined, when I use console.dir(file), I see error
So in your case, the code should look something like:
import fs from "fs";
export default defineComponent({
async run({ steps, $ }) {
// download the file from the cloud File Store
await $.files.open(`tesst.json`).toFile('/tmp/tesst.json);
// read the file version of the file stored in /tmp
return (await fs.promises.readFile('/tmp/tesst.json')).toString()
}
});