0

I tried this lines to Creating ReadSteam with uploaded files and pipe to WriteStream:

var f2 = req.files.f2;

var f2read = fs.createReadStream(f2)
var f2write = fs.createWriteStream("./trailers/" + id + ".mkv")
f2read.pipe(f2write)
    

but this error appeared:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of Object
bahoz99
  • 121
  • 1
  • 6

1 Answers1

0

As you can check - the variable f2 is not a string but an object. I suggest open the documentation of the tool which is used to handle file uploading on your project, as usual they already provide interfaces to receive Streams. Nodejs docs