Struggling with uploading the variables file for bulk mutation. JavaScript example please?

I can’t upload the file using the tutorial on documentation which uses curl command. Need a JS example.