How to upload file with path? - JS

I have a file. I want to upload that file as Parse.File. I know its path.

I tried reading file and converting bufer to base64 but I get invalid file uplaod error.

  var fileBuffer = fs.readFileSync(path);

  var media64 = fileBuffer.toString('base64');

  var mainmedia = new Parse.File(, { base64: media64 },mimeInfo.mime);

How can I upload file with its path?

After spending a day to solve this, It turns out my approach was fine and file path was incorrect. When I used correct file path file uploaded successfully.