Socket
Socket
Sign inDemoInstall

@integrance/google-drive-v3-helper

Package Overview
Dependencies
88
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @integrance/google-drive-v3-helper

Biblioteca que ajuda a trabalhar com a api V3 do google drive de maneira mais simplificada e com funcionalidades prontas.


Version published
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Google Drive V3 Helper

Biblioteca que ajuda a trabalhar com a api V3 do Google Drive de maneira mais simplificada e com funcionalidades prontas.

Objetivo

Esta biblioteca foi criada, a priori, para o uso em um outro produto para a startup Integrance, que, durante o desenvolvimento, foi notado uma pequena dificuldade em entender como algumas coisas funcionavam dentro do SDK da Google e como poderia ser chato e repetitivo a escrita de algumas funções. Para tentar resolver isso, a biblioteca nasceu para facilitar o trabalho com a api V3 do Google Drive e fornecer algumas funcionalidades prontas.

Funções

Atualmente, a biblioteca possui as seguintes funcionalidades:

  • Drive

    • saveFile: Salva um arquivo no drive;
    • getFile: Pega um arquivo do drive (informações e conteúdo);
    • getFilesInFolder: Pega todos os arquivos de uma pasta do drive (informações);
    • getFoldersInFolder: Pega todas as pastas de uma pasta do drive (informações);
    • getAllInFolder: Pega todos os arquivos e pastas de uma pasta do drive (informações);
    • createFolder: Cria uma pasta no drive;
    • deleteFileOrFolder: Deleta um arquivo ou pasta do drive;
    • copyFile: Copia um arquivo para outra (ou não) pasta do drive;
    • move: Move um arquivo para outra pasta do drive;
    • buildFunction: Fornece uma instância do drive_v3.Drive para criar e utilizar funções extras que não foram feitas acima;

    Novas funcionalidade serão adicionadas assim que possível. Por enquanto a biblioteca está me ajudando em outros sistemas que necessitam de conexão com a API do Google Drive V3, então enquanto estiver me suprindo, ela será bem estática e com poucas evoluções.

Instalação

Para instalar a biblioteca, basta realizar a instalação com um dos comandos abaixo:

Yarn: yarn add @integrance/google-drive-v3-helper

Npm: npm -i @integrance/google-drive-v3-helper

Uso

Para o uso da biblioteca, é necessário ter os seguintes requisitos:

- Criar um projeto no Google Cloud Platform;

- Ativar a API do Google Drive em seu projeto;

- Criar uma conta de serviço no Google Cloud Platform;

Após ter cumprido os requisitos, baixe o arquivo de credenciais (estrutura abaixo) que foi gerado nos passos anteriores:

// credentials.json
{
    "type": "",
    "project_id": "",
    "private_key_id": "",
    "private_key": "",
    "client_email": "",
    "client_id": "",
    "auth_uri": "",
    "token_uri": "",
    "auth_provider_x509_cert_url": "",
    "client_x509_cert_url": ""
}

Utilize-o da maneira que achar mais conveniente. No exemplo abaixo, iremos deixar o arquivo credentials.json na raiz do projeto e importaremos alguns informações de dentro dele utilizando require.

O exemplo abaixo mostra a configuração básica para a biblioteca:

// index.js
const { Drive } = require("@integrance/google-drive-v3-helper");

const { client_email, private_key } = require("./credentials.json");
const scopes = ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"];

const driveService = new Drive(client_email, private_key, scopes);

//driveService possui diversas funções prontas para serem utilizadas, fique livre para verificar seu conteúdo.

Licença

Este projeto é licenciado sob a MIT License

Copyright (c) 2022 Leonardo Petta do Nascimento

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Meta

Autor: Leonardo Petta do Nascimento

Email: leonardocps9@gmail.com

Linkedin: https://www.linkedin.com/in/leonardo-petta-do-nascimento-75674015b/

Site pessoal: https://leonardopetta.dev/portfolio-web/

Keywords

FAQs

Last updated on 13 Jan 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc