-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add setFile()
method
#26
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
Conversation
✅ Deploy Preview for blobs-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Looks good. Left one question and a nit, but they can be addressed whenever.
@@ -1,3 +1,7 @@ | |||
import { createReadStream } from 'node:fs' | |||
import { stat } from 'node:fs/promises' | |||
import { Readable } from 'node:stream' |
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.
Since this is also available as a Deno package, do you think it'd make sense to somehow use Deno-native FS APIs for this under Deno? e.g. by dependency-injecting an FS implementation?
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.
Deno now supports these native Node APIs, so these should work on both runtimes?
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.
Right, but presumably the native Deno APIs would be more performant? Probably doesn't make a difference, but could be interesting to at least do a measurement on it.
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.
OTOH, we probably won't upload a file from FS in Edge Functions in the foreseeable future, so scratch that 😅
Co-authored-by: Simon Knott <info@simonknott.de>
Which problem is this pull request solving?
Adds a
setFile(key: string, filePath: string)
that reads a file fromfilePath
and stores its contents on the blob store under the keykey
.