I think it would be helpful if this doc mentioned the scope of the blob storage. My assumption, because it is not mentioned, is that this is global (account-scoped), not val-scoped, i.e., if I get and set the same key from two different vals, they will be sharing and overwriting the same value in the global store.
Great note! I added this to the readme above: "Blob storage is scoped globally to your account. If you set a blob in one val, you can retrieve it by the same key in another val." What do you think?
Another note: I converted a val to use blob instead of separate val to store a string value, and I expected to use get and set because set has value: string | BodyInit for that. Took me a bit to figure out that
get returns a Response (though I can see why it does) and it is not what you want for storing a string
I can use getJSON with a plain string because a string is valid JSON
I think of these as things that could use noting in the docs rather than a problem with the API. However, I will say unqualified get/set presents to me as the default/simplest API unless I'm told otherwise, but it seems like getJSON/setJSON are actually the first thing most people will want to reach for. That is hinted at by the fact that most of the examples on this page and here use the JSON variant. I think get/set are good names based on the implementation (get is most general, getJSON wraps get) but it would be nice to see that more clearly in the docs.
I don't think rename/move is in the s3 API, so it'd be a get and then set operation, in which case building it would be a great pull request to this val (when we launch pull requests later today or tomorrow)
I think it would be helpful if this doc mentioned the scope of the blob storage. My assumption, because it is not mentioned, is that this is global (account-scoped), not val-scoped, i.e., if I get and set the same key from two different vals, they will be sharing and overwriting the same value in the global store.
Great note! I added this to the readme above: "Blob storage is scoped globally to your account. If you set a blob in one val, you can retrieve it by the same key in another val." What do you think?
Sounds good!
Another note: I converted a val to use blob instead of separate val to store a string value, and I expected to use
get
andset
becauseset
hasvalue: string | BodyInit
for that. Took me a bit to figure out thatget
returns aResponse
(though I can see why it does) and it is not what you want for storing a stringgetJSON
with a plain string because a string is valid JSONI think of these as things that could use noting in the docs rather than a problem with the API. However, I will say unqualified
get/set
presents to me as the default/simplest API unless I'm told otherwise, but it seems likegetJSON/setJSON
are actually the first thing most people will want to reach for. That is hinted at by the fact that most of the examples on this page and here use the JSON variant. I think get/set are good names based on the implementation (get
is most general,getJSON
wrapsget
) but it would be nice to see that more clearly in the docs.Great point! I reorganized the readme to emphasize how they are lower-level primitives. Lmk if you have any other suggestions
It would be nice to have a rename/move function here.
I don't think rename/move is in the s3 API, so it'd be a get and then set operation, in which case building it would be a great pull request to this val (when we launch pull requests later today or tomorrow)
Thanks for the PR @pomdtr!