#Do i need to read the contents first and
1 messages · Page 1 of 1 (latest)
Yes, WithNewFile expects the contents of the file as a string.
A very basic example:
func (m *DaggerExample) Test() *dagger.Directory {
return dag.Directory().WithNewFile("hello-world.txt", "hello world")
}
The entries command will give you the list of files and directories:
$ dagger call test entries
hello-world.txt
And you can inspect the contents with:
$ dagger call test file --path hello-world.txt contents
hello world