async function uploadToFolder(folderId) {
  // Get credentials and build service
  // TODO (developer) - Use appropriate auth mechanism for your app

  const fs = require('fs');
  const {GoogleAuth} = require('google-auth-library');
  const {google} = require('googleapis');

  const auth = new GoogleAuth({
    scopes: 'https://www.googleapis.com/auth/drive',
  });
  const service = google.drive({version: 'v2', auth});
  const fileMetadata = {
    title: 'photo.jpg',
    parents: [{id: folderId}],
  };
  const media = {
    mimeType: 'image/jpeg',
    body: fs.createReadStream('files/photo.jpg'),
  };

  try {
    const file = await service.files.insert({
      resource: fileMetadata,
      media: media,
      fields: 'id',
    });
    console.log('File Id:', file.data.id);
    return file.data.id;
  } catch (err) {
    // TODO(developer) - Handle error
    throw err;
  }
}
Upload a file to the specified folder and prints file ID, folder ID
@param{string} folderId folder ID