MCPcopy Create free account
hub / github.com/danthareja/node-google-apps-script / sendToGoogle

Function sendToGoogle

lib/commands/upload.js:34–57  ·  view source on GitHub ↗
(files, id)

Source from the content-addressed store, hash-verified

32};
33
34function sendToGoogle(files, id) {
35 if (!files.length) {
36 console.log('No Files to upload.'.red);
37 throw 'manifest file length is 0';
38 }
39
40 return authenticate()
41 .then(function(auth) {
42 var drive = google.drive({ version: 'v2', auth: auth });
43 var options = {
44 fileId: id,
45 media: {
46 mimeType: 'application/vnd.google-apps.script+json',
47 body: JSON.stringify({ files: files })
48 }
49 };
50
51 return Promise.promisify(drive.files.update)(options)
52 .catch(function(err) {
53 console.log('An error occured while running upload command: '.red + err.message);
54 throw err;
55 });
56 });
57}

Callers 1

upload.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected