Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
google-drive-connect
Advanced tools
Library to operate with Google Drive API v3 from Node.js, using system user tokens or personal keys
Library to operate with Google Drive API v3 from Node.js, using system user tokens or personal keys
This library is heavily inspired on theozero's' google-spreadsheet. No, I mean, really inspired. As in blatantly copied. The only difference being his library is to operate with google spreadsheets and this one is to interact with google drive.
So, basically, you can operate in two ways. You either use Google Oauth and manually enter your credentials everytime, or use a Service Account and forget about further authentications.
(the following is taken from google-spreadsheet docs)
Let's say you stored your user credentials in a file called my_credentials.json
. And you gave permission to the service account's email address over a folder in your Google Drive whose id is 1bibD4HDZVbqOPq882YSDTmZlI06fZvLU
. So you would do:
const YOUR_ROOT_FOLDER = '1bibD4HDZVbqOPq882YSDTmZlI06fZvLU',
PATH_TO_CREDENTIALS = path.resolve(`${__dirname}/my_credentials.json`);
// Let's wrap everything in an async function to use await sugar
async function ExampleOperations() {
const creds_service_user = require(PATH_TO_CREDENTIALS);
const googleDriveInstance = new NodeGoogleDrive({
ROOT_FOLDER: YOUR_ROOT_FOLDER
});
let gdrive = await googleDriveInstance.useServiceAccountAuth(
creds_service_user
);
// List Folders under the root folder
let folderResponse = await googleDriveInstance.listFolders(
YOUR_ROOT_FOLDER,
null,
false
);
console.log({ folders: folderResponse.folders });
// Create a folder under your root folder
let newFolder = { name: 'folder_example' + Date.now() },
createFolderResponse = await googleDriveInstance.createFolder(
YOUR_ROOT_FOLDER,
newFolder.name
);
newFolder.id = createFolderResponse.id;
debug(`Created folder ${newFolder.name} with id ${newFolder.id}`);
// List files under your root folder.
let listFilesResponse = await googleDriveInstance.listFiles(
YOUR_ROOT_FOLDER,
null,
false
);
for (let file of listFilesResponse.files) {
debug({ file });
}
}
ExampleOperations();
See API for a description of available methods.
FAQs
Library to operate with Google Drive API v3 from Node.js, using system user tokens or personal keys
The npm package google-drive-connect receives a total of 12 weekly downloads. As such, google-drive-connect popularity was classified as not popular.
We found that google-drive-connect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.