{"_rev":"4-e120e738c06b794f2b1873bc94a755ce","time":{"created":"2024-06-11T10:14:17.525Z","modified":"2024-06-11T10:14:18.037Z","1.0.8":"2024-06-11T10:05:03.154Z","1.0.9":"2024-06-11T10:07:46.699Z","1.0.10":"2024-06-11T10:14:17.779Z"},"_id":"@caporaldead/sab-adapter-google-cloud","name":"@caporaldead/sab-adapter-google-cloud","dist-tags":{"latest":"1.0.10"},"versions":{"1.0.10":{"name":"@caporaldead/sab-adapter-google-cloud","version":"1.0.10","description":"Temporary fork of tweedegolf/storage-abstraction - Provides an abstraction layer for interacting with Google Cloud storage service.","main":"dist/index/AdapterGoogleCloud.js","types":"dist/index/AdapterGoogleCloud.d.ts","homepage":"https://github.com/caporaldead/storage-abstraction/","repository":{"type":"git","url":"git+https://github.com/caporaldead/storage-abstraction.git"},"dependencies":{"@google-cloud/storage":"^7.11.1"},"scripts":{},"keywords":["google cloud","backblaze b2","amazon s3","storage","storage abstraction","cloud filesystem","cloudflare r2","cubbit","minio","azure"],"author":{"name":"caporaldead@devitek.fr"},"license":"MIT","publishConfig":{"access":"public"},"_id":"@caporaldead/sab-adapter-google-cloud@1.0.10","gitHead":"fb5bdff20be611f6c8b2ba8aee8db5f1e8ec064e","bugs":{"url":"https://github.com/caporaldead/storage-abstraction/issues"},"_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-OBxABIdHHwnFR6umnO/3891yAz7qZlkM29o3iFZC1O5OFOPbbkjTObsNmBpzzSCuGNDfDepgw5FpaeBJtIJAqg==","shasum":"3a510baa447e55be18e542a693116af49b1efa50","tarball":"https://registry.npmjs.org/@caporaldead/sab-adapter-google-cloud/-/sab-adapter-google-cloud-1.0.10.tgz","fileCount":27,"unpackedSize":76154,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCblIoyd6UKPpL70mn/lXNPxJmeWxPzyibt44IwP+uPMwIgLZWxRv5kvfbyFwjm9GV06IXBTh53NXN9JTILISAAuZQ="}]},"_npmUser":{"name":"caporaldead","email":"caporaldead+npmjs@gmail.com"},"directories":{},"maintainers":[{"name":"caporaldead","email":"caporaldead+npmjs@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sab-adapter-google-cloud_1.0.10_1718100857609_0.13265229393506317"},"_hasShrinkwrap":false}},"maintainers":[{"name":"caporaldead","email":"caporaldead+npmjs@gmail.com"}],"description":"Temporary fork of tweedegolf/storage-abstraction - Provides an abstraction layer for interacting with Google Cloud storage service.","homepage":"https://github.com/caporaldead/storage-abstraction/","keywords":["google cloud","backblaze b2","amazon s3","storage","storage abstraction","cloud filesystem","cloudflare r2","cubbit","minio","azure"],"repository":{"type":"git","url":"git+https://github.com/caporaldead/storage-abstraction.git"},"author":{"name":"caporaldead@devitek.fr"},"bugs":{"url":"https://github.com/caporaldead/storage-abstraction/issues"},"license":"MIT","readme":"# This package is a fork from https://github.com/tweedegolf/storage-abstraction\n\nThe only purpose of this package is to fix Google Cloud adapter 1.0.8 which is missing parenthesis.\n\n# Google Cloud Storage Adapter\n\nAn adapter that provides an abstraction layer over the API of the Google cloud storage service.\n\nThis adapter is one of the adapters that is meant to be used as a plugin of the [Storage Abstraction package](https://www.npmjs.com/package/@caporaldead/storage-abstraction). However it can be used standalone as well, see [below](#standalone).\n\nThe [API](https://github.com/caporaldead/storage-abstraction/tree/master?tab=readme-ov-file#adapter-api) of the adapter abstracts away the differences between the API's of cloud storage services. The API only supports the basic, most commonly used cloud service operations such as creating a bucket, storing files and so on.\n\nIt is also possible to access all the specific functionality of the cloud service API through the service client of the adapter, see [here](https://github.com/caporaldead/storage-abstraction/tree/master?tab=readme-ov-file#getserviceclient).\n\nIf you are new to the Storage Abstraction library you may want to read [this](https://github.com/caporaldead/storage-abstraction/blob/master/README.md#how-it-works) first.\n\n```typescript\nimport { Storage, StorageType } from \"@caporaldead/storage-abstraction\";\n\nconst configuration = {\n  type: StorageType.GCS,\n  keyFilename: \"path/to/keyFile.json\",\n};\n\nconst storage = new Storage(configuration);\n\nconst result = await storage.listBuckets();\n\nconsole.log(result);\n```\n\nThe Storage class is cloud service agnostic and doesn't know anything about the adapter it uses and adapters are completely interchangeable. It only expects the adapter to have implemented all methods of the `IAdapter` interface, see the [API](https://github.com/caporaldead/storage-abstraction/blob/master/README.md#adapter-api).\n\nWhen you create a Storage instance it checks the mandatory `type` key in the configuration object and then loads the appropriate adapter module automatically from your node_modules folder using `require()`. For more information please read [this](https://github.com/caporaldead/storage-abstraction/blob/master/README.md#register-your-adapter).\n\n## Configuration\n\nThe configuration object that you pass to the Storage constructor is forwarded to the constructor of the adapter.\n\nThe Storage constructor is only interested in the `type` key of the configuration object, all other keys are necessary for configuring the adapter.\n\nThe Storage constructor expects the configuration to be of type `StorageAdapterConfig`.\n\nThe adapter expects the configuration to be of type `AdapterConfig` or a type that extends this type.\n\n```typescript\nexport interface AdapterConfig {\n  bucketName?: string;\n  [id: string]: any; // any mandatory or optional key\n}\n\nexport interface StorageAdapterConfig extends AdapterConfig {\n  type: string;\n}\n```\n\nThe type of the configuration object for this adapter:\n\n```typescript\nexport interface AdapterConfigGoogle extends AdapterConfig {\n  keyFilename?: string;\n}\n```\n\n## Examples\n\nExamples with configuration object:\n\n```typescript\nconst s = new Storage({\n  type: StorageType.GCS,\n  keyFilename: \"path/to/keyFile.json\",\n});\n\nconst s = new Storage({\n  type: StorageType.GCS,\n  keyFilename: \"path/to/keyFile.json\",\n  bucketName: \"the-buck\",\n});\n```\n\nSame examples with configuration url:\n\n```typescript\nconst s = new Storage(\"gcs://path/to/keyFile.json\");\n\nconst s = new Storage(\"gcs://path/to/keyFile.json@the-buck\");\n```\n\nFor more information about configuration urls please read [this](https://github.com/caporaldead/storage-abstraction/blob/master/README.md#configuration-url).\n\n## Google Cloud Storage\n\nGoogle cloud service can read default credentials from an environment variable.\n\n```typescript\nconst s = new Storage({ type: StorageType.GCS });\n// using a config url:\nconst s = new Storage(\"gcs://\");\n// and even:\nconst s = new Storage(\"gcs\");\n```\n\nEnvironment variable that is automatically read:\n\n```shell\nGOOGLE_APPLICATION_CREDENTIALS=\"path/to/keyFile.json\"\n```\n\n## Standalone\n\nYou can also use the adapter standalone, without the need to create a Storage instance:\n\n```typescript\nimport { AdapterGoogleStorage } from \"@caporaldead/sab-adapter-google-storage\";\n\nconst a = new AdapterGoogleStorage();\nconst r = await a.listBuckets();\nconsole.log(r);\n```\n\n## API\n\nFor a complete description of the Adapter API see [this part](https://github.com/caporaldead/storage-abstraction/blob/master/README.md#adapter-api) documentation of the Storage Abstraction package readme.\n","readmeFilename":"README.md"}