google-api-nodejs-client

How to resumable upload with google drive node.js

我们两清 提交于 2019-12-01 12:41:11
Hey since google drive was changing their library I´am not able to upload anymore files bigger than 5MB with the basic upload drive.files.create . The docs told me that I have to choose resumable uploads instead. But google drive didn´t provide any sample code and aswell I can´t find anything on google. Maybe it´s important to know that I can upload files smaller than 5MB with the drive.files.create So there is no problem with the auth. https://developers.google.com/drive/v3/web/resumable-upload I wrote this POST request(Also not working with PUT): var fs = require('fs') var request = require(

gmail with table in message body is not getting displayed in mail but table data is displayed

喜欢而已 提交于 2019-12-01 12:26:51
问题 This is my actual output This is my expected output when a mail is sent with html table along with file attachment(like image, pdf, etc.), table format is not displayed in mail but content of table is displayed. But when I inspect mail body table is present. Problem is that its not shown in table format. But when mail sent with html table without attachment, table format is getting displayed in mail. How to fix it. let user = await db.model('User').findOne({ _id: userId }); let filepath = fs

Error 500 backendError with Gmail API and Google APIs Node Client

佐手、 提交于 2019-12-01 05:17:47
I'm trying to use the new Gmail API with the Google API Node client . I created a new project from the developer console, set up a new "Service Account" Client ID, and enabled access to the API. As a proof of concept, I am simply trying to list the threads in my inbox. When I enable the OAuth 2.0 toggle for the API explorer and enter my email address, the request succeeds and I see a JSON response with data. Now I try to do the same in Node: var googleapis = require('googleapis'); var SERVICE_ACCOUNT_EMAIL = '...SNIP...'; // generated by: openssl pkcs12 -in ...SNIP...p12 -out key.pem -nocerts

Get upload progress for Google Drive NodeJS client?

别等时光非礼了梦想. 提交于 2019-12-01 01:16:26
After we get the request object from req = drive.files.insert how to use it find file upload progress ? I searched for it in the req string by calling it multiple times but to no avail. function uploadFile(){ var path = untildify("~/workspace/incomplete/aw.jpg"); var drive = google.drive('v2'); var req = drive.files.insert({ resource: { title: 'aw.jpg' }, media: { body: fs.createReadStream(path) }, auth: oauth2Client }, function(err, response) { if (err) console.log(err); // else // console.log(response); }); console.log(req); } skwalker Here's how it's done function uploadFile(){ var path =

Google OAuth2 API Refresh Tokens

天大地大妈咪最大 提交于 2019-12-01 00:05:16
I'm using the google-auth-library-nodejs library to integrate into a number of GMail accounts, to get lists of emails. My process flow is simple: 1) Try to authorize the client, using this function: function _authorise(mailBox, callback) { let auth = new googleAuth(); let clientId = eval(`process.env.GMAIL_API_CLIENT_ID_${mailBox.toUpperCase()}`); let clientSecret = eval(`process.env.GMAIL_API_CLIENT_SECRET_${mailBox.toUpperCase()}`); let redirectUri = eval(`process.env.GMAIL_API_REDIRECT_URI_${mailBox.toUpperCase()}`); let tokenFile = process.env.GMAIL_API_TOKEN_PATH + mailBox.toLowerCase()+

Google Sheet Api get function returning undefined value in nodejs

有些话、适合烂在心里 提交于 2019-12-01 00:04:21
function changeData(auth,sheetId) { var sheets = google.sheets('v4'); sheets.spreadsheets.values.update({ auth: auth, spreadsheetId: sheetId, range: 'Sheet1!D6', valueInputOption: "USER_ENTERED", resource: { values: [ ["abc"] ] } }, (err, response) => { if (err) { console.log('The API returned an error: ' + err); return; } else { console.log("Appended"); } }); } I can get the above function to work and it changes the value just fine but the below function doesnt return value and says 0 rows retrieved. what am i doing wrong? function read(auth,sheet_id) { var sheets = google.sheets('v4');

Get upload progress for Google Drive NodeJS client?

你离开我真会死。 提交于 2019-11-30 19:11:43
问题 After we get the request object from req = drive.files.insert how to use it find file upload progress ? I searched for it in the req string by calling it multiple times but to no avail. function uploadFile(){ var path = untildify("~/workspace/incomplete/aw.jpg"); var drive = google.drive('v2'); var req = drive.files.insert({ resource: { title: 'aw.jpg' }, media: { body: fs.createReadStream(path) }, auth: oauth2Client }, function(err, response) { if (err) console.log(err); // else // console

Google Sheet Api get function returning undefined value in nodejs

丶灬走出姿态 提交于 2019-11-30 18:37:57
问题 function changeData(auth,sheetId) { var sheets = google.sheets('v4'); sheets.spreadsheets.values.update({ auth: auth, spreadsheetId: sheetId, range: 'Sheet1!D6', valueInputOption: "USER_ENTERED", resource: { values: [ ["abc"] ] } }, (err, response) => { if (err) { console.log('The API returned an error: ' + err); return; } else { console.log("Appended"); } }); } I can get the above function to work and it changes the value just fine but the below function doesnt return value and says 0 rows

File Upload With Loopback

与世无争的帅哥 提交于 2019-11-30 16:25:18
I created a Simple file uploading Application with loopback. Application client side i used simple html and Java Script code . i calling a loopback api with ajax call , this is Java Script code - $('#upload-input').on('change', function () { var files = $(this).get(0).files; if (files.length > 0) { // One or more files selected, process the file upload var form = new FormData(); for (var index = 0; index < files.length; index++) { var file = files[index]; form.append('Uploded Files', file, file.name); } $.ajax({ url: 'api/fileupload/upload', type: 'POST', data: form, processData: false,

Get access token on server side javascript (nodejs) using google authorization code received from client side

谁说胖子不能爱 提交于 2019-11-30 13:55:35
i have gone through this documentation :- https://developers.google.com/identity/sign-in/web/server-side-flow At the last step it receives the authorization code and after that it shows the example of receiving access token and refresh token using java or python libraries, but i cant find any similar example in nodejs. How can i replicate the same example using nodejs? Can't i just send a post or get request to some google oauth api and receive the access token using authorization code? Thanks in advance :) Google APIs Node.js Client library offers oauth2Client.getToken(code, cb) which gives