Reading content from URL with Node.js

前端 未结 4 1216
情深已故
情深已故 2020-12-02 20:12

I\'m trying to read the content from a URL with Node.js but all I seem to get are a bunch of bytes. I\'m obviously doing something wrong but I\'m not sure what. This is the

4条回答
  •  孤街浪徒
    2020-12-02 21:05

    the data object is a buffer of bytes. Simply call .toString() to get human-readable code:

    console.log( data.toString() );
    

    reference: Node.js buffers

提交回复
热议问题