[Help] Google Drive export example not working
See original GitHub issueI have the code from the drive export example with the sampleClient and it’s producing an error.
(node:3593) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘on’ of undefined
function download(fileId) {
drive.files.get({
fileId: fileId
}, (err, metadata) => {
if (err) {
throw err;
}
console.log('Downloading %s...', metadata.name);
const dest = fs.createWriteStream(metadata.name + '.csv');
drive.files.export({
fileId: fileId,
mimeType: 'text/csv'
})
.on('error', err => {
console.error('Error downloading file!');
throw err;
})
.pipe(dest);
dest
.on('finish', () => {
console.log('Downloaded %s!', metadata.name);
process.exit();
})
.on('error', err => {
console.error('Error writing file!');
throw err;
});
});
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:20 (3 by maintainers)
Top Results From Across the Web
Troubleshoot problems running or exporting a report
Technical issues are usually the reason a report fails to run or export. For example, reports containing very long date ranges may timeout...
Read more >How to fix Google Drive not downloading files - Setapp
As you can see, the Google Drive not downloading problem has lots of potential solutions. First, try a few options of downloading the...
Read more >7 Tips to Fix Google Drive Not Loading Problem
Method 1. Clear the Caches and Cookies · Method 2. Check for Update · Method 3. Disable Browser's Plugins · Method 4. Restart...
Read more >Files: export | Google Drive
Exports a Google Workspace document to the requested MIME type and returns ... If not specified, the response includes a default set of...
Read more >Best Fix: Google Drive Not Downloading - Alphr
If you're trying to download a document, photo, or video to your Android device from Drive and it's not working, there could be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
finally i made a export script working for me, i hope help someone else;
is important the
responseType: "stream"
to have a stream inresponse.data
. options are passed toaxios.request
, here you can find all optionsI’m having the same issue running the sample code from the drive download example. (https://github.com/google/google-api-nodejs-client/blob/master/samples/drive/download.js)
TypeError: Cannot read property ‘on’ of undefined