Skip to content

Conversation

@warmwaffles
Copy link
Contributor

@warmwaffles warmwaffles commented Apr 2, 2025

I've found the need to pass along the content type and disposition to Amazon in order to have the correct metadata set on the object. I did not want to load the entire binary into memory to call write. Instead, I would like to stream the file from disk.

This also expands the typespecs defined. I've opted for String.t() in places where I feel the developer should know that it is intended to be a human readable value. Even though under the hood binary() and String.t() are the same thing, it's still a good signal to the reader.

I realize this will conflict with #34, but I am going to rework that one a bit.

@warmwaffles warmwaffles force-pushed the add-opts-to-upload branch 2 times, most recently from 0a95cc6 to acc84ef Compare April 2, 2025 05:28
end

def upload(store, source, key) do
def upload(store, source, key, opts) do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add this as a required positional argument, wouldn't that be a breaking change? Should we preserve upload/3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be. The default opt \\ [] will fill that in.


def upload(store, source, key) do
FileStore.upload(store.__next__, source, put_prefix(key, store))
def upload(store, source, key, opts) do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thought here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will break some what, but a compiler error on the down stream consumer will be returned. They will be notified that they need to fill the rest of it in.

@warmwaffles
Copy link
Contributor Author

Side note, I don't use these middleware things. I don't know if anyone actually does and if it is even that important to have support for them.

I've found the need to pass along the content type and disposition to
Amazon in order to have the correct metadata set on the object. I did
not want to load the entire binary into memory to call `write`. Instead,
I would like to stream the file from disk.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants