Skip to content
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

Node.js typings (ReadStream methods) #9710

Closed
tarurar opened this issue Jun 18, 2016 · 7 comments
Closed

Node.js typings (ReadStream methods) #9710

tarurar opened this issue Jun 18, 2016 · 7 comments

Comments

@tarurar
Copy link
Contributor

tarurar commented Jun 18, 2016

I want to talk about node/node.d.ts.
The method destroy of class fs.ReadStream is not available in the definition. I can call this method in regular javascript but not in typescript. Is it ok?

@tarurar tarurar changed the title Node.js typings Node.js typings (ReadStream methods) Jun 18, 2016
@vvakame
Copy link
Member

vvakame commented Jun 19, 2016

please send a pull request first. I'll review it.

@DanielRosenwasser
Copy link
Member

@tarurar where exactly is this API documented? I can't find it on Node's site.

@tarurar
Copy link
Contributor Author

tarurar commented Jun 19, 2016

@DanielRosenwasser I don't see it either, but if you try to examine the __proto__ of the ReadStream object you will find this method:
ReadStream { open: [Function], _read: [Function], destroy: [Function], close: [Function] }

I saw examples in javascript which uses stream.destroy() to eliminate memory leaks.

@tarurar
Copy link
Contributor Author

tarurar commented Jun 19, 2016

@vvakame ok, done

@DanielRosenwasser
Copy link
Member

@tarurar interestingly I just saw a PR relating to this pop up:

nodejs/node#5898 (comment)

In other words, it should probably be documented, but it should be fine to add here.

@rhyek
Copy link

rhyek commented Dec 11, 2020

Hi. Just hit this. Wanted to make a PR for this, but wanted to understand the difference between the Readable class and the ReadableStream global interface.

The class is defining more methods than the interface, but a few packages I use (like dockerode) uses the global NodeJS.ReadableStream instead of the class. Seems like that may be common.

I believe the interface should define all these methods and the class should implement them, correct?

@orta
Copy link
Collaborator

orta commented Jun 23, 2021

Hi thread, we're moving DefinitelyTyped to use GitHub Discussions for conversations the @types modules in DefinitelyTyped.

To help with the transition, we're closing all issues which haven't had activity in the last 6 months, which includes this issue. If you think closing this issue is a mistake, please pop into the TypeScript Community Discord and mention the issue in the definitely-typed channel.

@orta orta closed this as completed Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants