i sending request in nodejs using request
module. set encoding:null
response buffer
.
now, content-type response header, decide whether treat buffer image, video or audio. extracting first part of content type header. example, png image has content type image/png
, such first part image
.
however, not find way predictably determine genre of text response. example, json can have content type application/json.
i make list of keywords find in content type value or make list of content types think text based (but that's tedious.)