Use node to download qq Music. If something goes wrong, take a look.

  node.js, question

The code is as follows:

"use strict";
 
 var color = require('./config');
 
 var http = require('http');
 
 var stream = require('stream');
 
 var cp = require('stream-cp');
 
 var path = require('path');
 
 http.get('http://124.205.69.134/files/12080000000E3800/cc.stream.qqmusic.qq.com/C200003xv4w313tZHV.m4a',(res)=>{
 res.setEncoding('utf-8');
 console.log("hhh");
 var data = '';
 res.on('data',(chunk)=>{
 Dataplus =chunk;
 console.log("lll");
 });
 res.on('end',()=>{
 var s = new stream.Readable();
 s.push(data);
 cp(s,`${__dirname}/build/`,function(file){
 return file
 },function(err){
 console.log('done');
 });
 console.log("kkk");
 })
 })

The error is as follows:

fs.js:857
 return binding.readdir(pathModule._makeLong(path));
 ^
 
 TypeError: path must be a string
 at TypeError (native)
 at Object.fs.readdirSync (fs.js:857:18)
 at cp (D:\gks\testbuild\node_modules\stream-cp\index.js:14:19)
 at IncomingMessage.<anonymous> (D:\gks\testbuild\testbuild.js:24:3)
 at emitNone (events.js:73:20)
 at IncomingMessage.emit (events.js:167:7)
 at endReadableNT (_stream_readable.js:906:12)
 at nextTickCallbackWith2Args (node.js:455:9)
 at process._tickCallback (node.js:369:17)

Ask for help, if you feel the problem is too small, you can ignore it.

path must be a string