Skip to content

Commit

Permalink
fix(example): sample exited before finishing write to disk (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttv20 authored and bcoe committed Sep 12, 2019
1 parent bc32427 commit 26ac7d8
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions samples/drive/export.js
Expand Up @@ -35,15 +35,10 @@ async function runSample() {
);
await new Promise((resolve, reject) => {
res.data
.on('end', () => {
console.log(`Done downloading document: ${destPath}.`);
resolve();
})
.on('error', err => {
console.error('Error downloading document.');
reject(err);
})
.pipe(dest);
.on('error', reject)
.pipe(dest)
.on('error', reject)
.on('finish', resolve);
});
// [END main_body]
}
Expand Down

0 comments on commit 26ac7d8

Please sign in to comment.