#Export,Stdout,WithNewFile? What is the best & simplest way to get a result as a file on the host?

1 messages · Page 1 of 1 (latest)

fallen gale
#

Hi,
I have a method the return a File, I have a second method that use this file to transform it but I don't know how to get the result as a new file on my machine...
when trying with export('.....') this does not works even with /foo, foo, . as 1st param
how to do this, properly in my code ?
Thank you for your advice

modest flower
#

👋 Hi @fallen gale! That really depends on the use case. Either way, dagger cannot programmatically export files, directories, etc. without appending the export --path=<place> to your dagger call command.

As an example in this module (https://github.com/jasonmccallister/dagger-composer/blob/main/main.go#L56), I'm returning a directory of PHP dependencies. I can call this function and export to the host filesystem:

dagger call -m github.com/jasonmccallister/dagger-composer install export --path vendor

The -m github.com/jasonmccallister/dagger-composer would not be required if I added this as a dependency to my current module using dagger install.

fallen gale
#

thank you for your help !
so we can read files/directories in our code, but we can't write anything / the user must explicitly use export in args ?