I'm having some real trouble downloading files from google drive via googleapis node.
This is my current code that I've got working to
drive.files.export(
{
auth: this.jwtToken,
fileId: fileId,
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
},
async function (err, file, response)
{
console.log(file.data);
}
)
Out put is text like the following:
�0$Ҡċ�E��4���G��[�V�%�;]�4,횕9�M������;
�� o���(�* S��Ca�VJ�e\a���}8x%3�a֩�3��L��4f�4�:�<H2�`�ʗ� ���-6�g�����[K������[���M��&zD1��S�����@�ǽ5�b��ظ��w�~���#-�P\ϲ�lt�!Q��M�"�
But when I use the code from the google example as seen here: https://developers.google.com/drive/api/v3/manage-downloads
I get the following errors:
TypeError: drive.files.export(...).on is not a function
And when I try to save the string from my method then I get a corrupt file when I try to open it.
What am I doing wrong?