-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: download file via url #112
Conversation
1329f3b
to
daf74ef
Compare
src/packages/StorageFileApi.ts
Outdated
@@ -258,10 +258,12 @@ export default class StorageFileApi { | |||
* | |||
* @param path The file path, including the current file name. For example `folder/image.png`. | |||
* @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. | |||
* @param options customizes the public url with query string params |
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.
I think a better to document this for it to show up in our docs is to do
@param options.download triggers the file as a download the file if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
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.
@inian Fixed
daf74ef
to
bb62008
Compare
🎉 This PR is included in version 2.0.0-rc.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* feat: improve function return types (#60) * feat: improve types * chore: better error handling * feat: custom storage api error * chore: use custom error type * chore: update custom error type * chore: replace instanceof with isStorageError * chore: move isStorageError to a non-static method * Improve `uploadOrUpdate` returned data. (#63) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * Also return the clean path for the uploaded file. * Update readme. * Add bucket id in returned data. * Update readme * Fix return type for `upload` and `update`. * Fix typo in code snippet comment. * Rename `downloadPath` to `path` * Update return types Co-authored-by: Jonathan Picques <jonathan.picques@gmail.com> Co-authored-by: Bobbie Soedirgo <bobbie@soedirgo.dev> Co-authored-by: Mircea-Pavel Anton <mircea.anton99@yahoo.com> * Improve `getPublicUrl` (#62) * Improve `getPublicUrl` * Make return types consistent across all functions. * Undo return type change * Change the `getPublicUrl` method to return only the url as string. * Remove redundant method. * Update tests. Co-authored-by: Mircea-Pavel Anton <mircea.anton99@yahoo.com> * upload, update: don't return bucketId as a return parameter and in the path. Just returning the path without the bucket id makes it easier to pass the value in to other storage-js functions. Also not calling it Key -- was uppercase and not as clear as just calling it path. * add docs folder to .gitignore * Merge branch 'master' into chore/merge-master-04-08-22 (#82) * fix: remove release config from package.json (#83) * chore: merge main into next (#85) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * chore: add search param to SearchOptions jsdoc on list function (#59) * build(release-next): sets up the next branch as an npm prerelease (#80) * fix: rename main release branch (#84) Co-authored-by: Jonathan Picques <jonathan.picques@gmail.com> Co-authored-by: Bobbie Soedirgo <bobbie@soedirgo.dev> * fix: encode all urls fixes #78 this should ideally be done in the api server, but doing this breaking change at the client library first, so when we do it at the backend, only folks who are using the api directly will need to upgrade. * return values is always wrapped by data signedURL used to return a url directly and inside the data object. This is inconsistent. Now we always return values inside a data object only. * fix: pass through all values returned by backend instead of cherry picking only name - we still do this in the types though. also ensures data is always an object. Fixes #6 * fix tests * fix metadata type Previously accessing metada.contentType would throw a type error since we set the type to an empty object. * only export StorageClient #46 removing the change we added for backward compatibility * update ci to node 16 * upgrade typedoc to latest version * fix: move bucket and file api to package folder docs look better when we do this and add the packages to the entrypoint to the typedoc command * modify publicurl to always return data all methods return data and an error * dont return error for getPublicUrl * fix: signed url is returned as signedUrl matches the method name createSignedUrl * downgrade typedoc to 0.22.16 our doc generation pipeline only works with 0.22.16 for now * exclude protected properties from typedoc * fix: typedocs * chore: merge main into next (#99) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * chore: add search param to SearchOptions jsdoc on list function (#59) * build(release-next): sets up the next branch as an npm prerelease (#80) * fix: rename main release branch (#84) * build(release-rc): sets up the rc branch as an npm prerelease (#98) Co-authored-by: Jonathan Picques <jonathan.picques@gmail.com> Co-authored-by: Bobbie Soedirgo <bobbie@soedirgo.dev> * feat: Release V2 RC BREAKING CHANGE: Release V2 * update docs (#102) * Fix docs typo (#104) * chore: increased test coverage (#106) * fix: consistent return types for copy (#110) * feat: download file via url (#112) * fix: merge main into rc (#113) * fix: typo in updateBucket jsdoc * fix: import cross-fetch conditionally * fix: es2020 * chore: add search param to SearchOptions jsdoc on list function (#59) * build(release-next): sets up the next branch as an npm prerelease (#80) * fix: rename main release branch (#84) * build(release-rc): sets up the rc branch as an npm prerelease (#98) * Adds v1 docs (#107) * docs: ci Co-authored-by: Jonathan Picques <jonathan.picques@gmail.com> Co-authored-by: Bobbie Soedirgo <bobbie@soedirgo.dev> Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com> Co-authored-by: Mircea-Pavel Anton <contact@mirceanton.com> Co-authored-by: Jonathan Picques <jonathan.picques@gmail.com> Co-authored-by: Bobbie Soedirgo <bobbie@soedirgo.dev> Co-authored-by: Mircea-Pavel Anton <mircea.anton99@yahoo.com> Co-authored-by: Inian <inian1234@gmail.com> Co-authored-by: Fabrizio <fabri.feno@gmail.com> Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>
What kind of change does this PR introduce?
feature
What is the current behavior?
What is the new behavior?
Adds the
download
option to the following methods:getPublicUrl
getSignedUrl
getSignedUrls
Additional context
Support downloading a file via url supabase/storage#195