#Save file content to filesystem
1 messages · Page 1 of 1 (latest)
Hello, you should be able to do it using:
dag.Directory().WithNewFile("/file/path", "contents")
to give a slightly more complete example:
output, err := dag.Container().
From("alpine:latest").
WithDirectory("/foo", dag.Directory()).
WithNewFile("/foo/test.txt", "some content").
WithExec([]string{"sh", "-c", "cat /foo/test.txt"}).
Stdout(ctx)
if err != nil {
return "", err
}
return output, err
}```
thank you so much @frosty fox i totally missed that method 
np, happy to help.
note, we should have dag.file() to mirror dag.directory() no?
i dont think we currently have that. we should probably add that
Yes that's what I mean - for sure we don't have it, but we should add it 🙂