Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Download a file from Google Drive.
- Future downloadFile(drive.DriveApi api,
- Client client,
- String objectId,
- String filename) {
- return api.files.get(objectId).then((drive.File file) {
- // The Drive API allows one to download files via `File.downloadUrl`.
- return client.readBytes(file.downloadUrl).then((bytes) {
- var stream = new File(filename).openWrite()..add(bytes);
- return stream.close();
- });
- });
Add Comment
Please, Sign In to add comment