Giter Site home page Giter Site logo

Support Node 10 API about cacheable HOT 8 CLOSED

szmarczak avatar szmarczak commented on June 13, 2024
Support Node 10 API

from cacheable.

Comments (8)

adityapatadia avatar adityapatadia commented on June 13, 2024 1

I will love if new GOT works perfectly fine with streams including caching. Our use-case is that our responses must be streams, whether they are cached or not. Basically the files we are requesting are huge so it's always preferred to keep stream rather than convert to buffer.

from cacheable.

adityapatadia avatar adityapatadia commented on June 13, 2024

I am ready to implement all of the changes in this library and do major refactor but @lukechilds seems to be taking too much time merging PRs. This library also has many problems:

  • messed up codebase. super hard to understand
  • got.stream when used in conjunction with cacheable request, the cached response always is buffer because how the responselike library used by this cacheable-request handles it poorly: https://github.com/lukechilds/responselike/blob/master/src/index.js
  • minor caching bugs here and there which I don't exactly remember.

As a result I have created a fork: https://github.com/gumlet/cacheable-request

I maintain it and if GOT wishes, they can migrate to that module: https://www.npmjs.com/package/improved-cacheable-request

I love GOT and I am ready to implement the required changes in my library for GOT v10. If nothing works, at least provide an option in GOT with which, we can easily switch the cacheable-request library.

from cacheable.

szmarczak avatar szmarczak commented on June 13, 2024

messed up codebase. super hard to understand

I disagree :P It's not that hard 😉

got.stream when used in conjunction with cacheable request, the cached response always is buffer because how the responselike library used by this cacheable-request handles it poorly:

I don't think you can cache the response without downloading the body first...

I maintain it and if GOT wishes, they can migrate to that module

That won't be necessary. I'm gonna redesign this module once I've finished my current work on Got.

from cacheable.

szmarczak avatar szmarczak commented on June 13, 2024

I love GOT and I am ready to implement the required changes in my library for GOT v10.

Well, you could override the request option for now...

from cacheable.

adityapatadia avatar adityapatadia commented on June 13, 2024

@szmarczak It's hard compared to my redesigned codebase.

The problem is actually not the download part. There it's handled very well. The problem is that responselike module is designed in such a way that even if a cache adapter is able to return stream while retrieving from cache, the responselike module forbids it. Any cache must return buffer and then responselike module converts it to stream in ugly way.

It would be awesome if you redesign this module (actually I like the fact that you agree that re-design is necessary). Please let us know if any redesign is there in your mind. I (and my company) would love to offer our axe for any amount of work which can improve this module.

from cacheable.

szmarczak avatar szmarczak commented on June 13, 2024

the responselike module forbids it

You can use to-readable-stream.

I (and my company) would love to offer our axe for any amount of work which can improve this module.

I'll post here when I start :)

from cacheable.

adityapatadia avatar adityapatadia commented on June 13, 2024

@szmarczak let me know if you are ready to start. I am sorry to be pushy but this library is super critical for our project so want to get it improved as soon as possible,

from cacheable.

jaredwray avatar jaredwray commented on June 13, 2024

closing this out as we are now working to support Node 12, 14, 16, and 18. Should be updated in the next 90 days.

from cacheable.

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.