npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-fad-google-drive

v2.1.1

Published

## Installation

Downloads

1

Readme

Getting started

Installation

npm install ng-fad-google-drive

It is important to configure your application in: Click here

Description

a) Gets the list of files on google drive. The search is done by filtering through a query b) Gets the base64 and blob of the selected file

Dependencies

npm install @fadportal/portal-models

Import

In the file necessary example.component.ts import the service.

import { FadGoogleDriveService } from 'ng-fad-google-drive';
.
.
.
...  constructor(private googleDrive: FadGoogleDriveService) { }

Usage

Typescript

Inject service called FadGoogleDriveService Before using any method it is important to initialize that google drive requires with the method initGoogleDrive To see the errors it is necessary to subscribe to the method onErrorGoogleDrive

  private API_KEY = 'YOUR_GOOGLE_API_KEY';
  private CLIENT_ID = 'YOUR_GOOGLE_CLIENT_ID';

  constructor(private googleDrive: FadGoogleDriveService) { }

  ngOnInit(): void {
    // Observe errors
    this.onerror();

    // Observe files
    this.ongetfiles();
  }

  async getFiles() {
    /**
     * Initializaton of Google Drive
     * @param {string} apiKey Necessary data to initialize google
     * @param {string} clientId Necessary data to initialize google
     * @return {Promise<boolean>}
     */
    const init = await this.oneDrive.initGoogleDrive(this.API_KEY, this.CLIENT_ID);

    if (init) {
      /**
       * Trigger Google Drive files
       * @param {string} q Filter to Google Drive list (view Google documentation)
       * @param {number} pageSize Number of files per response. By default it is 100
       */
      const q = "mimeType='application/pdf'"
      const pageSize = 10;
      this.googleDrive.getGoogleDriveFiles(q, pageSize);
    }
  }

  async getFile(fileId: string, mimeType: string) {
    /**
     * Get base64 of Google Drive file
     * @param {string} mimeType Format of your file (is provided for each item in the Google Drive document list)
     * @return {Promise<FadGoogleDriveModelFileFormat>}
     */

    const data = await this.googleDrive.getGoogleDriveFile(fileId, mimeType);
    console.log(data);
  }

  ongetfiles() {
    /**
     * Get items from a google drive account 
     * @return {Observable<FadGoogleDriveModelFileList[]>}
     */

    this.googleDrive.onGetGoogleDriveFiles().subscribe(res => {
      // Google Drive files
      console.log(res);
    });
  }

  onerror() {
    /**
     * Get errors from service
     * @return {Observable<FadPortalModelErrorModule>}
     */

    this.googleDrive.onErrorGoogleDriveFiles().subscribe(res => {
      // Manage errors
      console.log(res);
    });
  }