1

I wanted to do something like this:

app.post("/", function(req, res){
    var readStream = fs.createReadStream(req.body.image);
    var writeStream = fs.createWriteStream(__dirname + "canvas.png");
    readStream.pipe(writeStream)
    console.log(req.body)
    res.redirect("/")
})

I believe I have to create a file when using fs.createReadStream so I'm assuming that is why it is not working. I just want to stream the image that was created from canvas into someplace on the server. I really want to stream the image into GridFs I'm not sure why I have to make the files on the server for the read stream. I just did this for practice since I have no experience with streaming or GridFs . I'm taking baby steps.

I successfully send the image to the post handler it begins with data:image/png;base64

jack blank
  • 5,073
  • 7
  • 41
  • 73

0 Answers0