I want pipe fs.createReadStream
twice, the code is here:
fs.createReadStream('pdf-sample1.pdf')
.pipe(fs.createWriteStream('pdf-sample2.pdf'))
.pipe(fs.createWriteStream('pdf-sample3.pdf'))
But i meet an error:
Error: Cannot pipe. Not readable.
at WriteStream.Writable.pipe (_stream_writable.js:162:22)
at repl:1:86
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
who can tell me the reason?