
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
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
The npm package node-google-drive receives a total of 241 weekly downloads. As such, node-google-drive popularity was classified as not popular.
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.