cloudinary error: [Error: ENOENT: no such file or directory code example

Example: cloudinary error: [Error: ENOENT: no such file or directory

const express = require("express");
const bodyParser = require('body-parser');
const router = express.Router();
const path = require('path');

require('dotenv').config();
require('../../client/src/components/handlers/cloudinary');
const cloudinary =require("cloudinary");
var multer  = require('multer');
var storage = multer.memoryStorage();
var upload = multer({ storage: storage });
var stream = require('stream');

router.put('/:id', upload.single('image'), function(req, res, next) {
    var upload_stream = cloudinary.v2.uploader.upload_stream(function(err,image) {   
        res.send(image.secure_url);
  });
  console.log(upload_stream);
  var bufferStream = new stream.PassThrough();
  bufferStream.end(req.file.buffer);
  bufferStream.pipe(upload_stream);
  })

Tags:

Misc Example