3.2.0 • Published 4 months ago

@ejekanshjain/cloud-storage v3.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

cloud-storage

Import any one the client in your code base like this

import { AzureStorageClient } from '@ejekanshjain/cloud-storage'
import { GCPStorageClient } from '@ejekanshjain/cloud-storage'
import { S3Client } from '@ejekanshjain/cloud-storage'

Initialize storageClient like this

const s3Client = S3Client({
  region: process.env.AWS_REGION!,
  accessKey: process.env.AWS_ACCESS_KEY!,
  accessSecret: process.env.AWS_ACCESS_SECRET!,
  bucket: process.env.AWS_BUCKET!,
  host: process.env.AWS_HOST
})

Then you can call these methods to perform CRUD operations on file

await s3Client.addFile({
  filename: "test.txt",
  data: "Hello, World!"
})

await s3Client.getFile("test.txt")

await s3Client.deleteFile("test.txt")

You can use the similar approach for Cloudflare R2, GCP Buckets, Azure Storage Buckets, Firebase Storage

Troubleshoot gcp/firebase storage bucket for cors error on anonymous

Go to Cloud console Create a file cors.json

[
  {
    "origin": ["https://example.com"],
    "method": ["GET"],
    "maxAgeSeconds": 3600
  }
]

Now run this command

gsutil cors set cors.json gs://exampleproject.appspot.com
3.2.0

4 months ago

3.1.0

7 months ago

3.0.1

7 months ago

3.0.0

7 months ago

2.2.0

9 months ago

2.1.0

9 months ago

2.0.3

9 months ago

2.0.2

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.1.0

9 months ago

1.0.0

9 months ago