Coder Social home page Coder Social logo

Comments (4)

ryangribble avatar ryangribble commented on June 6, 2024

Speaking for octokit.net we also automatically follow redirects so our method for this does return a Byte[] byte array of the actual archive content. However we have named the method GetArchive so the behaviour is more expected by consumers.

For node, I think if it's called getArchiveLink then yes it should return the URL only. But you could also just call it getArchive (either instead of or in addition to the getArchiveLink call)

from discussions.

paulmelnikow avatar paulmelnikow commented on June 6, 2024

Though I understand the Github instructions are "follow all redirects," it just doesn't make a lot of sense for something that is intended to return a big blob vs. 1k of JSON.

I certainly understand our perspectives could be different, though wanted to ring in with mine.

Since some repos are small and others are really not, it's not great to put the whole thing into memory. In Node the way to do getArchive would be to return a Stream, or else to accept a path and write the archive there.

Maybe the stream is the way to go. That wouldn't get in the way of following redirects.

from discussions.

gr2m avatar gr2m commented on June 6, 2024

@paulmelnikow I fully agree with you. There are a few incoherences in GitHub’s REST API, this is one of them, and I want to make sure that all Octokits are handling it in the same way, which is why I brought up the point.

For octokit.js, I have to keep browser-compatibility in mind, too, so streams are tough.

I tend towards changing the behavior of getArchiveLink() to just return the link, as that’s how I interpret the intent of the endpoint: https://developer.github.com/v3/repos/contents/#get-archive-link

Once you have the link, you can do whatever you want with it, like creating a stream in Node.js.

Any thoughts from @octokit/rb?

from discussions.

paulmelnikow avatar paulmelnikow commented on June 6, 2024

For octokit.js, I have to keep browser-compatibility in mind, too, so streams are tough.

Makes sense!

Once you have the link, you can do whatever you want with it, like creating a stream in Node.js.

Or following that link in in a browser.

from discussions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.