Unix cat
In Unix, the cat command is a utility that reads files and writes them to standard output. You can use Ende to mimic the behavior of the cat command.
In this program each command-line argument is assumed to be a filename, the file is opened, and printed to stdout (e.g. the console).
Create a script that reads the contents of one or more files and writes them to standard output.
for (const filename of Ende.args) {
const file = await Ende.open(filename);
await file.readable.pipeTo(Ende.stdout.writable, { preventClose: true });
}Run this example locally using the Ende CLI:
ende run -R https://docs.ende.sh/examples/scripts/unix_cat.ts file1 file2