-
-
Save tonydspaniard/5cdce18bd401075a9c6c47b2cd253b3f to your computer and use it in GitHub Desktop.
nodejs drive api v3 fetch children files from folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GoogleAuth = require('google-auth-library') | |
const OAuth2Client = GoogleAuth.OAuth2Client | |
const google = require('googleapis') | |
const clientId = '<YOUR_CLIENT_ID>' | |
const clientSecret = '<YOUR_CLIENT_SECRET>' | |
const redirectUri = '<Your URI Callback>' | |
const oauth2Client = new OAuth2Client(clientId, clientSecret, redirectUri) | |
// your oauth method, see documentation | |
const drive = google.drive({ version: 'v3', auth: oauth2Client }) | |
/** | |
From now on, if you want to get the list of children, you must use a query string, in the form of | |
"'IDofYourFolder in' parents" where "in parents" indicates that Drive should look into IDofYouFolder | |
**/ | |
drive.files.list({ | |
q: `'${googleFolderId}' in parents` | |
}, (err, data) => { | |
if (err) throw err | |
console.log('your files', data) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment