github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/site/reference/cli/fn/sink/README.md (about) 1 --- 2 title: "`sink`" 3 linkTitle: "sink" 4 type: docs 5 description: > 6 Write resources to a local directory 7 --- 8 9 <!--mdtogo:Short 10 Write resources to a local directory 11 --> 12 13 `sink` reads resources from `stdin` and writes them to a local directory. 14 Resources must be in one of the following input formats: 15 16 1. Multi object YAML where resources are separated by `---`. 17 18 2. KRM Function Specification wire format where resources are wrapped in an 19 object of kind ResourceList. 20 21 `sink` is useful for chaining functions using Unix pipe. For more details, refer 22 to [Chaining functions]. 23 24 ### Synopsis 25 26 <!--mdtogo:Long--> 27 28 ``` 29 kpt fn sink DIR [flags] 30 31 DIR: 32 Path to a local directory to write resources to. The directory must not already exist. 33 ``` 34 35 <!--mdtogo--> 36 37 ### Examples 38 39 <!--mdtogo:Examples--> 40 41 ```shell 42 # read resources from DIR directory, execute my-fn on them and write the 43 # output to DIR directory. 44 $ kpt fn source DIR | 45 kpt fn eval - --image gcr.io/example.com/my-fn | 46 kpt fn sink NEW_DIR 47 ``` 48 49 <!--mdtogo--> 50 51 [chaining functions]: 52 /book/04-using-functions/02-imperative-function-execution?id=chaining-functions-using-the-unix-pipe 53 [function specification]: 54 /book/05-developing-functions/01-functions-specification