![](/img/trans.png)
[英]What are the differences between readable and data event of process.stdin stream?
[英]what's the distinction between process.stdin and process.stdout vs. http request and response?
我正在學習Node.js,並且在本教程中經常會練習分配作業,以便通過process.stdin進行某種輸入,對其進行修改或過濾,然后將其傳遞給process.stdout,同時,作為一個提示,有一些示例代碼使用http.createServer( function(req, res) { req.pipe( function of some sort... res.end()
,有時它可能類似於此process.stdin.pipe( function "something perhaps involving the through module"...).pipe(process.stdout)
http.createServer( function(req, res) { req.pipe( function of some sort... res.end()
process.stdin.pipe( function "something perhaps involving the through module"...).pipe(process.stdout)
。
區別在於前者(processor.stdin / out)正在編寫命令行程序。 后者(http.createServer)正在創建一個微型Web服務器,其中“輸入”(頁面請求)和“輸出”(結果頁面)基本上將由瀏覽器通過HTTP管理。 沒有演示任何特定於Web的教程可能會使用命令行,因為它更簡單。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.