diff --git a/README.adoc b/README.adoc index 86cdb91..0a170fa 100644 --- a/README.adoc +++ b/README.adoc @@ -13194,6 +13194,7 @@ Examples: ** link:rootfs_overlay/lkmc/nodejs/command_line_arguments.js[] * `fs` ** link:rootfs_overlay/lkmc/nodejs/file_write_read.js[] +** link:rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js[] Question: https://stackoverflow.com/questions/30441025/read-all-text-from-stdin-to-a-string === Userland content bibliography diff --git a/rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js b/rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js new file mode 100755 index 0000000..cb6e85c --- /dev/null +++ b/rootfs_overlay/lkmc/nodejs/read_stdin_to_string.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node + +// https://cirosantilli.com/linux-kernel-module-cheat#node-js + +const fs = require('fs'); +console.log(fs.readFileSync(0, 'utf8'));