cat method
implementation for the cat function.
Implementation
Future<void> cat(String path, {LineAction stdout = print}) async {
final sourceFile = File(path);
verbose(() => 'cat: ${truepath(path)}');
if (!exists(path)) {
throw CatException('The file at ${truepath(path)} does not exists');
}
await sourceFile
.openRead()
.transform(utf8.decoder)
.transform(const LineSplitter())
.forEach((line) {
stdout(line);
});
}