last day (29 days later) » 

22:39
0
Q: How to remove an event listener in NodeJS?

TheBasementNerdI can't figure out how this is supposed to be implemented. Every time I try, it either complains that removeEventListener is not a function, or some other random error. Currently this is in the context of being used as chunks of data are written into a file, and I need to use drain occassionally ...

Show your code where you're adding this listener in the first place.
Updated, sorry I'm being slack I'm just getting annoyed with this project
This looks like a doozie. :-) Can you show what the format is that you're trying to write to a file? We can probably help you refactor it. Also, consider implementing a TransformStream instead of this. That way, you can pipe the output wherever. What you're doing with the drain and what not doesn't make sense.
Its an array where each element contains a string, the (|S|) are custom separators I used to help the code format the lines because the original text contains random things that I would normally use as separators, but can't because they're already in there
Also I tried a transform stream and had no idea how to work it, so I gave up with that
Why not use one of the many off-the-shelf CSV encoders? They have built-in escape sequences so you don't have to worry about the separators in the strings. Or, something standard like JSON or CBOR?
22:39
It takes a few weeks to get approval for a new package to add to a language per project. Its an annoying system, and the reason I'm trying to implement it is because I tried to add worker threads to my code but it let to the result of heap memory overflow. I looked it up and read that I likely needed to drain my stream, and so that's where I am at the moment, trying to figure out how I'm supposed to drain it and remove the drain listener to prevent memory overflow
Can you show us an actual example of the data, and the actual example of the line you want to write?
How is that related to removing event listeners?
I was going to help you refactor this, but if you'd rather I don't, fine. You have a lot of misconceptions here, and I thought I'd help you get pointed in the right direction. Please edit your question with the example... the comments box is eating the formatting. Also, if that isn't a fake name/address... please make it one.
There's 5 million lines in this file so I can't post all the original data, but the lines are all like that
To answer your question exactly... you can use .off(). But this of course does nothing to solve your actual problem.
I'm not asking you to post your file, I'm asking you to show us what you're trying to do, in your question.
22:40
What do you mean by the actual problem? I know my code is janky, this is my first time trying to do a professional project with coding, its been all hobby up to this point
22:54
I would like to learn but I have no idea what the hell I'm doing with this

  last day (29 days later) »