I am pulling a file from a 3rd party system and it is returning the data in the response as a string. Now when using that string to upload to drive it is uploading but the file is not opening. I tried converting the string to Blob but it is not possible in node.js. How can I upload correctly using that string of data?
let res=await axios.get("getting the file from 3rd party system",headers);
  
  let fileToUpload=res.data;   // storing the file in variable
  
 let data={
  name:'image.png',
  parents:['1BD50Xdf5456ghec8Ccwa5YNEkpgPaOxdE_M']
};
let head={
      headers: {
        'Content-Type': 'application/json; charset=UTF-8',
        'Content-Length':127494,
        'Authorization': 'Bearer '+driveaccessToken
    }
};
  //request to upload metadata
 res=await axios.post('https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable',JSON.stringify(data),head);
  //getting the content upload url from response
 let uploadUrl=res.headers.location;
 
 //uploading the content
  res = await axios.put(uploadUrl,fileToUpload,head);
  console.log(res.status);