Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs');
- const { google } = require('googleapis');
- const Auth = require('../authorization/auth_drive/auth');
- // get data
- var gotData = function copyFile(copyFileId, name, callback) {
- let content = fs.readFileSync('./GEARS/authorization/client_secret.json');
- Auth(JSON.parse(content), (auth) => {
- const returnData = [];
- const drive = google.drive({ version: 'v3', auth });
- drive.files.copy({
- fileId: copyFileId,
- resource: {
- name: name
- }
- }, (err) => {
- if (err) {
- returnData.push(["ERR"]);
- returnData.push("" + err);
- } else {
- returnData.push(["OK"]);
- }
- callback(returnData);
- });
- });
- };
- module.exports = gotData;
Add Comment
Please, Sign In to add comment