No such file or directory ENOENT, yet file exists

461 views Asked by At

I am running a node app that takes an uploaded file to the directory and then pushes it to a Minio Object Server. When uploading files it works as intended with around 80% of the files. However, with some of them, I get the ENOENT error. I cant seem to figure out why, it works will large files and small files and can't identify any similarities between the files I get this error with.

The method below is called every time a file is successfully uploaded and is where the error is thrown on occasion.

  form.on('file', function(field, file) {
    fs.rename(file.path, path.join(form.uploadDir, file.name));
    console.log("successs" +file.path);
    minioClient.fPutObject('123', file.name, path.join(form.uploadDir, file.name), 'application/octet-stream', function(err, etag) {
        if (err) return console.log(err)
        console.log('File uploaded successfully.')

      });

   });
0

There are 0 answers