Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
node-google-drive
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
We found that node-google-drive 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.