Code Monkey home page Code Monkey logo

Comments (3)

dougwilson avatar dougwilson commented on July 26, 2024

That's a good question, but I'm not sure this is a good thing to do. For example, there would be no guarantee that one of things are being used on the steam unless there is a way that can be checked in the implementation here before emitting it?

There are all kinds of things that can do things on an event, and emitting it on something we don't understand could cause other code to trigger incorrectly, especially if the stream already closed the underlying resource and emitted close and now this module emitted it a second time?

from destroy.

dougwilson avatar dougwilson commented on July 26, 2024

An example of where this can be an issue I see in just the first streams doc for Writable

https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_event_close

The 'close' event is emitted when the stream and any of its underlying resources (a file descriptor, for example) have been closed. The event indicates that no more events will be emitted, and no further computation will occur.

It would seem that if this module emitted it a second time on a Writable, that would violate the API guarantees of the stream, making using this module more unsafe than it should be.

from destroy.

watson avatar watson commented on July 26, 2024

Makes sense. Thanks for looking into this.. Let's just close this issue 😃

from destroy.

Related Issues (3)

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.