I've done the Google Drive API integration. User can choose/upload file from google drive. Now, I want to save google drive file into my local directory.
I am getting binary data of file using below code (res.body) when I'm selecting file(s) from Google Drive.
I'm getting binary data of file in "res.body". How to save file into local directory using this binary data.
//====Called when a file has been selected in the Google Picker Dialog Box======
PickerResponse: function(data) {
if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
var file = data[google.picker.Response.DOCUMENTS][0],
id = file[google.picker.Document.ID],
request = gapi.client.drive.files.get({
fileId: id
});
this.ShowPicker();
request.execute(this.GetFileDetails.bind(this));
gapi.client.drive.files.get({
fileId: id,
alt: "media"
}).then(function(res) { **
console.log(res.body) **
});
}
}