{"id":29974501,"url":"https://github.com/luvlqq/nestjs-googledrive","last_synced_at":"2025-08-04T07:07:33.562Z","repository":{"id":212463732,"uuid":"731538019","full_name":"luvlqq/nestjs-googledrive","owner":"luvlqq","description":"NestJs Google Drive lib for upload files","archived":false,"fork":false,"pushed_at":"2024-11-21T19:18:16.000Z","size":195,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T19:05:42.840Z","etag":null,"topics":["googledrive","googledriveapi","nestjs","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nestjs-googledrive-upload","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luvlqq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-14T09:58:47.000Z","updated_at":"2025-03-14T14:30:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"3551c64f-3b6c-47cd-8e87-ad8bca9a11a7","html_url":"https://github.com/luvlqq/nestjs-googledrive","commit_stats":null,"previous_names":["luvlqq/nestjs-googledrive"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/luvlqq/nestjs-googledrive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvlqq%2Fnestjs-googledrive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvlqq%2Fnestjs-googledrive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvlqq%2Fnestjs-googledrive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvlqq%2Fnestjs-googledrive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luvlqq","download_url":"https://codeload.github.com/luvlqq/nestjs-googledrive/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvlqq%2Fnestjs-googledrive/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268568811,"owners_count":24271457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["googledrive","googledriveapi","nestjs","nodejs"],"created_at":"2025-08-04T07:01:58.325Z","updated_at":"2025-08-04T07:07:33.553Z","avatar_url":"https://github.com/luvlqq.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Drive Library for NestJS\n\nThis library provides a NestJS module for interacting with Google Drive. It includes a service for uploading and retrieving images.\n\n## Installation\n\nInstall the library with npm:\n\n```bash\nnpm install nestjs-googledrive-upload\n```\n\n## Usage\n\nFirst, import `GoogleDriveModule` into your module:\n\n```ts\nimport { GoogleDriveModule, GoogleDriveConfig } from 'nestjs-googledrive-upload';\n```\n\nWatch this [video](https://youtu.be/-YZRkIbNWY0?t=43) for check how to get your Google Drive config.\n\n```ts\nimport { GoogleDriveModule, GoogleDriveConfig } from 'nestjs-googledrive-upload';\n\n@Module({\n  imports: [\n    GoogleDriveModule.register(\n      {\n        type: '...',\n        project_id: '...',\n        private_key_id: '...',\n        private_key: '...',\n        client_email: '...',\n        client_id: '...',\n        auth_uri: '...',\n        token_uri: '...',\n        auth_provider_x509_cert_url: '...',\n        client_x509_cert_url: '...',\n        universe_domain: '...',\n      } as GoogleDriveConfig,\n      'your-google-drive-folder-id',\n    ),\n    // other modules...\n  ],\n  // providers, controllers, etc...\n})\nexport class YourModule {}\n\n```\nOr you can create json config file like below\n\nGoogle Drive API example\n```json\n{\n  \"type\": \"...\",\n  \"project_id\": \"...\",\n  \"private_key_id\": \"...\",\n  \"private_key\": \"...\",\n  \"client_email\": \"...\",\n  \"client_id\": \"...\",\n  \"auth_uri\": \"...\",\n  \"token_uri\": \"...\",\n  \"auth_provider_x509_cert_url\": \"...\",\n  \"client_x509_cert_url\": \"...\",\n  \"universe_domain\": \"...\"\n}\n```\n\nAnd change in your `tsconfig`\n```json\n\"compilerOptions\": {\n    \"resolveJsonModule\": true,\n  }\n```\n\n## .register\n\n```ts\nimport * as config from 'src/testdir/config.json';\n\n@Module({\n  imports: [\n    GoogleDriveModule.register(config as GoogleDriveConfig, 'your-google-drive-folder-id'),\n  ],\n})\n```\n## .registerAsync\n\nThe `registerAsync` method in the `GoogleDriveModule` allows for registering the module asynchronously with the ability to dynamically configure the configuration.\n\n### Syntax\n\n```ts\nGoogleDriveModule.registerAsync(options: GoogleDriveModuleAsyncOptions): DynamicModule\n```\n\nParameters:\n- options (GoogleDriveModuleAsyncOptions): The options object for asynchronously registering the module. It contains the following properties:\n- imports (optional): An array of NestJS modules that need to be imported before creating the GoogleDriveModule module.\n- useFactory: The function that will be invoked to asynchronously create the configuration. It should return an object configuration or a promise with the configuration object.\n- inject (optional): An array of dependencies to be injected into the useFactory function.\n\n### Usage\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { GoogleDriveModule } from 'nestjs-googledrive-upload';\n\n@Module({\n  imports: [\n    GoogleDriveModule.registerAsync({\n      imports: [], // Can import other modules if needed\n      useFactory: async () =\u003e {\n        // Your code to asynchronously fetch the configuration\n        const config = await fetchConfigFromSomewhere();\n        return config;\n      },\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n---\n\nThen, you can use GoogleDriveService in your services:\n\n```ts\nimport { Injectable } from '@nestjs/common';\nimport { GoogleDriveService } from 'nestjs-googledrive-upload';\n\n@Injectable()\nexport class YourService {\n  constructor(private readonly googleDriveService: GoogleDriveService) {}\n\n  public async uploadImage(file: Express.Multer.File): Promise\u003cstring\u003e {\n    try {\n      const link = await this.googleDriveService.uploadImage(file);\n      // do something with the link, e.g., save it to the database\n      return link;\n    } catch (e) {\n      throw new Error(e);\n    }\n  }\n\n  public async getImage(fileId: string): Promise\u003cstring\u003e {\n    try {\n      const link = await this.googleDriveService.getImage(fileId);\n      // do something with the link, e.g., return it to the user\n      return link;\n    } catch (e) {\n      throw new Error(e);\n    }\n  }\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluvlqq%2Fnestjs-googledrive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluvlqq%2Fnestjs-googledrive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluvlqq%2Fnestjs-googledrive/lists"}