Open jhnnsrs opened 2 years ago
Thank you for sharing :)
I would be hesitant to put it into the codebase as it would introduce a dependency on aws4fetch
even for users that don't interact with s3(-compatible) stores.
But I would love to have this as an example in the docs! If you would be open to making a PR with that I'd happily merge that. I think it could deserve its own markdown file here, and then you would link in it in the sidebar here.
One improvement to your code: you could use a HEAD
request for containsItem
(docs), it saves downloading the entire chunk just to see if it exists :)
Agreed! Better no dependency hell.
Will write a few lines about it, and make a PR. Originally I had the HEAD request on containsItem, but HEAD is not always an allowed method on S3 endpoints (some minio deployments).
One thing we had also discussed previously would be to have the HTTPStore
a more general fetch-based store where you can provide your own fetch
implementation.
E.g.,
let store = new FetchStore(url, { fetch: globalThis.fetch }); // default, essentially current `HTTPStore`
let store = new FetchStore(url, {
fetch: new AwsClient({ /* ... */ }).fetch,
supportedMethods: ["GET"], // default ["GET", "PUT", "OPTIONS"],
});
Regardless, I think this example would be really great to have in our documentation!
Sounds great to me. Maybe I would still stick with the HTTPStore naming though. But I love the more compositional approach.
Hi!
First thanks for the great work, especially for the effort in types! As a lot of the community uses S3 for storage, I was wondering if you would be interested in supporting a dedicated S3 Store (building on the HTTP Store but with support for accessKeys and secretKeys? I could spin up a PR, but here is already an implementation using "aws4fetch".
Hope that might help some!