Code Monkey home page Code Monkey logo

Comments (13)

dougwilson avatar dougwilson commented on June 12, 2024 1

I'm going to close this as stale. Unless Node.js adds some kind of progress events to the fs streams, it is probably not possible.

from send.

dougwilson avatar dougwilson commented on June 12, 2024 1

Because to open a feature request in Node.js, you need to also champain it and even implement it yourself as a pull request if you cannot convince a maintainer to do it. You can read more about how feature requests work in their guidelines. I have no bandwidth to do such a thing, unfortunately.

But anyone who does is welcome to do so.

from send.

dougwilson avatar dougwilson commented on June 12, 2024

No, there is not a way to do this currently that I am aware of.

from send.

karmac2015 avatar karmac2015 commented on June 12, 2024

I solve it now by registering the stream event then register data event for stream like the following:

send(...)
.on('stream', stream => {
  stream.on('data', chunk=> {
      // calculate progress here
  })
})
.pipe(...)

I tried to use progress-stream to detect progress but not works for me. If there is a way to use this library with send library please tell me how.

from send.

dougwilson avatar dougwilson commented on June 12, 2024

Ah, yea, I was going to suggest something similar, but that has one main issue: I think that registering on a stream data listener may turn off the back pressure feature of Node.js, which can balloon your app's memory usage. It would also be the progress read of your local fs, and not the progress of sending to the end client.

from send.

karmac2015 avatar karmac2015 commented on June 12, 2024

So how can I do that? please help me

from send.

dougwilson avatar dougwilson commented on June 12, 2024

Just looking at progress-stream module I don't think it's possible to work without adding some new support to it to support progress on http responses from server pov.

from send.

dougwilson avatar dougwilson commented on June 12, 2024

I don't know the solution, or I would have posted already :) and now I'm on mobile phone, so cannot try anything out until perhaps tomorrow at the earliest.

from send.

karmac2015 avatar karmac2015 commented on June 12, 2024

Ok thank you, but please one last question if I use through2 library so pipe data to the library then pipe it to response it has an effect on the back pressure like registering data event for stream ?

from send.

dougwilson avatar dougwilson commented on June 12, 2024

I'm not familiar with the through2 lib, so would need some time to learn it and test it and get the answer for you.

from send.

karmac2015 avatar karmac2015 commented on June 12, 2024

Ok thank you very much

from send.

karmac2015 avatar karmac2015 commented on June 12, 2024

Hello, is there any solution till now ?

from send.

hello-smile6 avatar hello-smile6 commented on June 12, 2024

I'm going to close this as stale. Unless Node.js adds some kind of progress events to the fs streams, it is probably not possible.

Then why not open an issue for Node?

from send.

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.