-
Notifications
You must be signed in to change notification settings - Fork 208
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
Feature | graph init
Add support to download spkg files from spkg.io
#1642
base: main
Are you sure you want to change the base?
Feature | graph init
Add support to download spkg files from spkg.io
#1642
Conversation
…ature/graph-init-spkg-io-support
🦋 Changeset detectedLatest commit: 7d24759 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
graph init
Add support to download spkg files from spkg.io
Hi @saihaj can you please review this PR? Let me know if there's anything you need me to do before you merge it. Thanks! |
thanks @joshuanazareth97 sorry for the delay. I was away on vacation last week, catching up on things will try to land this early next week |
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.
few minor nits, thanks for adding tests!
(sorry for the delayed review)
import { createWriteStream } from 'fs'; | ||
import { http } from 'gluegun'; | ||
|
||
export async function downloadFile(fileUrl: string, outputLocationPath: string) { | ||
const writer = createWriteStream(outputLocationPath); | ||
const api = http.create({ | ||
baseURL: fileUrl, | ||
}); | ||
return api.get('', {}, { responseType: 'stream' }).then((response: any) => { | ||
response.data.pipe(writer); | ||
return Promise.resolve(outputLocationPath); | ||
}); | ||
} |
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 would use fetch
, we maintain an internal wrapper that also passes some headers that can let origin servers know where the traffic is coming from.
export default function fetchWrapper( |
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.
Have now resolved this to use the wrapped fetch
Co-authored-by: Saihajpreet Singh <[email protected]>
@joshuanazareth97 are you still working on this? |
…anazareth97/graph-tooling into feature/graph-init-spkg-io-support
…ature/graph-init-spkg-io-support
@saihaj apologies, was occupied with some other stuff last week. Have addressed all your comments. |
@saihaj is there anything else you need me to do here? Can we merge this PR if the changes are made to your satisfaction? |
Change Description
Related Issue / Discussion
#1641
Screenshot of change