{"id":15597982,"url":"https://github.com/nalbion/any-cloud-storage","last_synced_at":"2025-09-20T08:32:55.278Z","repository":{"id":222412561,"uuid":"757234054","full_name":"nalbion/any-cloud-storage","owner":"nalbion","description":"Provides a common interface for file storage across multiple cloud providers including AWS, GCP, Firebase, Supabase, git and local file-system storage.","archived":false,"fork":false,"pushed_at":"2024-02-14T06:44:50.000Z","size":106,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T21:24:43.092Z","etag":null,"topics":["aws-s3","firebase-storage","gcp-storage","git","s3-storage","supabase-storage"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nalbion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2024-02-14T04:15:09.000Z","updated_at":"2024-06-03T06:45:10.867Z","dependencies_parsed_at":null,"dependency_job_id":"03ff845d-76ba-4c58-aa8c-564f9262a507","html_url":"https://github.com/nalbion/any-cloud-storage","commit_stats":null,"previous_names":["nalbion/any-cloud-storage"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalbion%2Fany-cloud-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalbion%2Fany-cloud-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalbion%2Fany-cloud-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nalbion%2Fany-cloud-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nalbion","download_url":"https://codeload.github.com/nalbion/any-cloud-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233648603,"owners_count":18708225,"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","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":["aws-s3","firebase-storage","gcp-storage","git","s3-storage","supabase-storage"],"created_at":"2024-10-03T01:25:22.431Z","updated_at":"2025-09-20T08:32:49.982Z","avatar_url":"https://github.com/nalbion.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# any-cloud-storage\n\n`any-cloud-storage` provides a common interface for file storage across multiple cloud providers including [AWS S3](https://aws.amazon.com/s3/), [GCP](https://cloud.google.com/storage), [Firebase](https://firebase.google.com/docs/storage/), [Supabase](https://supabase.com/storage), `git` and local file-system storage.\n\n## Interface\n\nThe library provides the `FileStorage` interface with the following methods:\n\n- `saveFile(filePath, data: Buffer, { encoding: 'utf-8', contentType: 'text/plain' })`\n- `saveTextFile(filePath, data: string)`\n- `readFile(filePath) =\u003e Promise\u003cBuffer\u003e`\n- `readTextFile(filePath) =\u003e Promise\u003cstring\u003e`\n- `deleteFile(filePath)`\n- `listFiles(directoryPath) =\u003e Promise\u003cstring[]\u003e`\n\n## Configuration\n\nEach implementation can be configured using a nested map of `string` | `number` | `boolean` | `array` so that the configuration can be saved in a JSON/YAML file.\n\n### Examples:\n\n- `{ type: 'file', basePath }`\n- `{ type: 'firebase', bucketUrl: 'gs://my-custom-bucket' }`\n- `{ type: 'gcp', bucketName, apiEndpoint? }`\n- `{ type: 'git', repoUrl, username, options?: { baseDir?, binary?, config? } }`\n- `{ type: 's3', bucket }`\n- `{ type: 'supabase', url, key, bucket }`\n\n## Usage\n\nImport `createStorage` and call it with your `config` to create a storage instance.\n\n```typescript\nimport createStorage from \"any-cloud-storage\";\n\nconst config = { type: \"file\", basePath: \"/tmp\" };\n// const config = {\n//   type: 's3',\n//   bucket: 'my-bucket',\n//   region: 'us-west-2',\n//   // other AWS S3 configuration options...\n// };\n\nconst storage = createStorage(config);\n```\n\nAlternatively, you directly import the implementation you want to use:\n\n```typescript\nimport LocalFileStorage from \"any-cloud-storage/implementations/LocalFileStorage\";\n\nconst storage = new LocalFileStorage(\"/tmp\");\n```\n\nNow you can use the `storage` instance to read/write files:\n\n```typescript\nconst filePath = \"path/to/my/file.txt\";\nconst text = \"Hello, world!\";\n\n// Save a file\nawait storage.saveTextFile(filePath, text);\n// or await storage.saveFile(filePath, Buffer.from(text, 'utf-8'));\n\n// Read a file\nconst readDate = await storage.readTextFile(filePath);\n// or const readData = (await storage.readFile(filePath)).toString('utf-8');\nconsole.log(readData); // 'Hello, world!'\n\n// List files\nconst files = await storage.listFiles(\"path/to/my\");\nconsole.log(files); // ['file.txt']\n\n// Delete a file\nawait storage.deleteFile(filePath);\n```\n\n## Implementations\n\nThe library includes implementations for the following cloud providers:\n\n- Firebase (`FirebaseClientStorage`)\n- Google Cloud Platform (`GcpStorage`)\n- Git (`GitStorage`)\n- Local file system (`LocalFileStorage`)\n- AWS (`S3FileStorage`)\n- Supabase (`SupabaseStorage`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnalbion%2Fany-cloud-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnalbion%2Fany-cloud-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnalbion%2Fany-cloud-storage/lists"}