{"id":29948636,"url":"https://github.com/vbrazo/gcp-cloud-storage-upload-example","last_synced_at":"2025-08-03T08:33:31.312Z","repository":{"id":304235737,"uuid":"1018191977","full_name":"vbrazo/gcp-cloud-storage-upload-example","owner":"vbrazo","description":"A Node.js GCP Cloud Storage upload example for Alexandre","archived":false,"fork":false,"pushed_at":"2025-07-11T19:24:18.000Z","size":1780,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-11T21:20:32.558Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vbrazo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-07-11T19:12:01.000Z","updated_at":"2025-07-11T19:29:26.000Z","dependencies_parsed_at":"2025-07-11T21:20:42.232Z","dependency_job_id":null,"html_url":"https://github.com/vbrazo/gcp-cloud-storage-upload-example","commit_stats":null,"previous_names":["vbrazo/gcp-cloud-storage-upload-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/vbrazo/gcp-cloud-storage-upload-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbrazo%2Fgcp-cloud-storage-upload-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbrazo%2Fgcp-cloud-storage-upload-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbrazo%2Fgcp-cloud-storage-upload-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbrazo%2Fgcp-cloud-storage-upload-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vbrazo","download_url":"https://codeload.github.com/vbrazo/gcp-cloud-storage-upload-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbrazo%2Fgcp-cloud-storage-upload-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268514973,"owners_count":24262536,"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":[],"created_at":"2025-08-03T08:33:29.388Z","updated_at":"2025-08-03T08:33:31.288Z","avatar_url":"https://github.com/vbrazo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCP Cloud Storage Demo (Node.js)\n\nThis project demonstrates how to upload files to a Google Cloud Storage bucket using Node.js and the official `@google-cloud/storage` SDK.\n\n## 🚀 Features\n\n- Upload a local file to a GCP bucket\n- Simple setup using service account authentication\n- Easy to extend for downloading or listing files\n\n---\n\n## 🛠 Requirements\n\n- Node.js (v14+ recommended)\n- A Google Cloud project with **Cloud Storage API** enabled\n- A **service account key** with `Storage Object Admin` permissions\n\n---\n\n## 📦 Installation\n\n1. **Clone the repository:**\n\n```bash\ngit clone https://github.com/your-username/gcp-storage-demo.git\ncd gcp-storage-demo\n```\n\n2. **Install dependencies:**\n\n```bash\nnpm install\n```\n\n## 🔐 Authentication\n\nThis project uses a service account to authenticate with GCP.\n- Go to IAM \u0026 Admin \u003e Service Accounts in the Google Cloud Console.\n- Create a service account (if you don’t already have one).\n- Grant it the Storage Admin or Storage Object Admin role.\n- Create and download a JSON key.\n- Set the environment variable:\n\n```bash\nexport GOOGLE_APPLICATION_CREDENTIALS=\"/absolute/path/to/your-key.json\"\n```\n\n## 📁 Prepare a Test File\n\n```bash\necho \"Hello from GCP Storage!\" \u003e test-upload.txt\n```\n\n## 🚀 Run the Upload Script\n\nMake sure to edit index.js and set your bucket name:\n\n```js\nconst BUCKET_NAME = 'your-bucket-name'; // \u003c-- replace this\n```\n\nThen run:\n\n```bash\nnode index.js\n```\n\nIf successful, you should see:\n\n```\n✅ File test-upload.txt uploaded to uploaded-test.txt\n```\n\n## 📂 Project Structure\n\n```\n.\n├── index.js               # Main upload script\n├── upload.test.js         # Mocha test for uploading and cleanup\n├── test-upload.txt        # Sample file to upload\n├── package.json\n└── README.md\n```\n\n## 🧪 Run Tests\n\nThis project includes a test that uploads a file, checks if it exists, and deletes it from the bucket.\n- Update upload.test.js with your bucket name.\n- Run the test:\n\n```bash\nnpm install --save-dev mocha\nnpm test\n```\n\nOr manually with\n\n```bash\nnpx mocha upload.test.js\n```\n\n## 📌 Notes\n\n-\tMake sure your bucket name is globally unique\n-\tIf using this in production, do not commit your JSON key\n-\tYou can extend this to include file download, list, and delete operations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvbrazo%2Fgcp-cloud-storage-upload-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvbrazo%2Fgcp-cloud-storage-upload-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvbrazo%2Fgcp-cloud-storage-upload-example/lists"}