function listFiles (auth) {
  const service = google.drive('v3');
  service.files.list({
    auth: auth,
    pageSize: 10,
    fields: 'nextPageToken, files(id, name)'
  }, (err, res) => {
    if (err) {
      console.error('The API returned an error.');
      throw err;
    }
    const files = res.data.files;
    if (files.length === 0) {
      console.log('No files found.');
    } else {
      console.log('Files:');
      for (const file of files) {
        console.log(`${file.name} (${file.id})`);
      }
    }
  });
}
/**
 * Lists the names and IDs of up to 10 files.
 * @param {google.auth.OAuth2} auth An authorized OAuth2 client.
 */
Lists the names and IDs of up to 10 files.
@param {google.auth.OAuth2} auth An authorized OAuth2 client.
Lists the names and IDs of up to 10 files . @param { google . auth . OAuth2 } auth An authorized OAuth2 client .
function listFiles (auth) {
  const service = google.drive('v3');
  service.files.list({
    auth: auth,
    pageSize: 10,
    fields: 'nextPageToken, files(id, name)'
  }, (err, res) => {
    if (err) {
      console.error('The API returned an error.');
      throw err;
    }
    const files = res.data.files;
    if (files.length === 0) {
      console.log('No files found.');
    } else {
      console.log('Files:');
      for (const file of files) {
        console.log(`${file.name} (${file.id})`);
      }
    }
  });
}
function listFiles ( auth ) { const service = google . drive ( 'v3' ) ; service . files . list ( { auth : auth , pageSize : 10 , fields : 'nextPageToken, files(id, name)' } , ( err , res ) => { if ( err ) { console . error ( 'The API returned an error.' ) ; throw err ; } const files = res . data . files ; if ( files . length === 0 ) { console . log ( 'No files found.' ) ; } else { console . log ( 'Files:' ) ; for ( const file of files ) { console . log ( ` ${ file . name } ${ file . id } ` ) ; } } } ) ; }
Lists the names and IDs of up to 10 files.
Lists the names and IDs of up to 10 files .