-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TempFileStorage #19
base: main
Are you sure you want to change the base?
Conversation
23d8762
to
745b2cd
Compare
745b2cd
to
3071b89
Compare
|
||
describe('TempFileStorage', () => { | ||
it('stores and retrieves files', async () => { | ||
await using storage = new TempFileStorage('test-'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa, this is new to me! I've never seen using
before. Very cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! This is very cool.
Since AsyncDisposable
is so new, would you be open to publishing this package yourself? At least until we can determine if it's going to be generally useful for many people?
The whole idea with the FileStorage
interface is that hopefully there will be many implementations for different storage backends, and people can just plug in whichever one they need for a given use case. I'd be happy to link to your package in the README to help others find it more easily.
I have added |
I realized while implementing
form-data-parser
in a project thatLocalFileStorage
is a bad fit for apps that process uploads before persisting them elsewhere. I wanted something that wrote to a temporary directory that was removed at the end of the request handler and was only initialized if the form data contained a file. So I wroteTempFileStorage
and wanted to contribute it back for others to use 😄The biggest uncertainty I have about this change is the support for
AsyncDisposable
in the general node ecosystem.