unjs / unstorage

💾 Unstorage provides an async Key-Value storage API with conventional features like multi driver mounting, watching and working with metadata, dozens of built-in drivers and a tiny core.
https://unstorage.unjs.io
MIT License
1.73k stars 129 forks source link

Cached Storage #15

Open pi0 opened 2 years ago

pi0 commented 2 years ago

(some good ideas in https://github.com/unjs/unstorage/issues/88)

chris-visser commented 2 years ago

Not sure wjat you mean with this, but I had this idea to allow setting the cache via s3 endpoints and then expose it via a cloudfront distribution.

I'm currently attempting to create the s3 driver. Wdyt of adding a cdn option to drivers like s3 and maube other bucket providers?

It would be something like this:

driver({ 
  bucket: 'my-site',
  region: 'eu-west-1',
  basePath: '/cache',
  acl: 'public-read',
  ...iamCredentials,
  cloudfrontDistribution: { ... } 
}