#export vs export

1 messages · Page 1 of 1 (latest)

spiral pendant
#

from official doc
I get this function in typescript:

  @func()
  getDir(): Directory {
    return this.base().directory("/src")
  }

then I can do dagger call get-dir export --path=/home/admin/export and I end up with files on my laptop.

But if instead of calling the export from the command line I modify the function like this

  @func()
  getDir(): Promise<string> {
    return this.base().directory("/src").export("/home/admin/export")
  }

I was expecting to see the same result... but it is not the case... Can someone explain to me what is the difference... (I thought that chaining from the command line or chaining from within the code was same....)

sacred isle
#

The latter exports the file from your base() container into the sandboxed environment. The former, due to being run by you on your machine, exports it onto your host. Security/sandboxing at work - same behaviour with services and the service.up() method.