Skip to content

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

Merged
merged 7 commits into from
Jul 27, 2023
Merged

feat: add setFile() method #26

merged 7 commits into from
Jul 27, 2023

Conversation

eduardoboucas
Copy link
Member

Which problem is this pull request solving?

Adds a setFile(key: string, filePath: string) that reads a file from filePath and stores its contents on the blob store under the key key.

@eduardoboucas eduardoboucas requested a review from a team as a code owner July 27, 2023 12:35
@netlify
Copy link

netlify bot commented Jul 27, 2023

Deploy Preview for blobs-js ready!

Name Link
🔨 Latest commit 3c201aa
🔍 Latest deploy log https://app.netlify.com/sites/blobs-js/deploys/64c296b1e753fe000807a52b
😎 Deploy Preview https://deploy-preview-26--blobs-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@eduardoboucas eduardoboucas changed the title Feat/get file feat: add setFile() method Jul 27, 2023
@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jul 27, 2023
Copy link
Contributor

@Skn0tt Skn0tt left a 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'
Copy link
Contributor

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?

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Contributor

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 😅

eduardoboucas and others added 2 commits July 27, 2023 17:07
Co-authored-by: Simon Knott <info@simonknott.de>
@eduardoboucas eduardoboucas merged commit b8dc848 into main Jul 27, 2023
@eduardoboucas eduardoboucas deleted the feat/get-file branch October 24, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants