Skip to main content

All Questions

Tagged with
1 vote
1 answer
887 views

Node js Child process event emitter vs callbacks

Is there any difference between attaching callbacks or event listeners for child process in nodejs. like - const execute = require('child-process').exec; const process = execute('ping -n 1 www.google....
sahil aktar's user avatar
0 votes
1 answer
752 views

NodeJS, HTTP Request doesn't Call a Callback Sometimes

I'm developing a Request service under Nodejs. I'm using it in production for more than a year and it works fine, however, there are cases when it is stuck. It happens rarely on a particular kind of ...
Miroslav Popov's user avatar
2 votes
1 answer
35 views

Should I use callbacks for events?

While browsing some old documentation for express, I found this example that uses callbacks for the "close" event: app.get('/page/', function (req, res) { res.writeHead(200, { /* . . . */ ); ...
ConfusedGuy's user avatar
0 votes
1 answer
241 views

Javascript / node.js - callbacks inside Promise

i have some callbacks inside my promise: var res = new Promise(resolve => { console.log('trig1'); var out = fs.createWriteStream(pathToFile); console.log('trig2'); out.on('finish', ...
Creative crypter's user avatar
1 vote
1 answer
331 views

in Node.js- Is there any relationship between Events (EventEmitter and Listener Function objects) and the asynchronous callbacks

I am exploring Node.js.I understand that Node.js core API is built around the idiomatic asynchronous event-driven architecture Now, by this I guess it means every time an asynchronous Function is ...
Srini's user avatar
  • 41
1 vote
1 answer
3k views

Node Extracting zip file async using callbacks or events?

I have to write a module whose task is to extract a zip file given two parameters (zip file's path, directory where to extract's path) which should expose a method to perform the task and then trigger ...
anchnk's user avatar
  • 301
0 votes
3 answers
44 views

NODEJS - Can't set headers after they are sent

I have function, that executes when 'dataCompiled' event fires, it looks like his: eventEmitter.on('dataCompiled', function () { json = JSON.stringify({ conversations: convs ...
Src's user avatar
  • 5,402
3 votes
1 answer
1k views

In node.js, when to use events, when to use a straight callback function?

It seems to me that the "core" node.js callback syntax, i.e. function foo(data, callback) { callback(false, data2); } is semantically superseded by events, except that With events, you lose the ...
Bet Lamed's user avatar
  • 483
5 votes
2 answers
3k views

Call a function after all currently scheduled callbacks are executed (node)

I am using a streaming multipart/form-data parser to handle file and field uploads. Whenever a new field or file is parsed an event is fired and I perform some processing. After all fields and files ...
naughty boy's user avatar
  • 2,129
0 votes
0 answers
61 views

How can I bind data to an event in node.js

Here is a boiled down version of the sort of code I've written: var cb_gen, item, list, label, token; cb_gen = function (token_string) { return function (data) { var msg = "logout of [" +...
Gary Krohmer's user avatar
0 votes
1 answer
182 views

Node.js, assigning callback function for event 'data'

How can I assign a call back function for event 'data' and give it more then 1 standard parameter ? Here is my script : var http = require('http'); var server = http.createServer().listen(8080); ...
slaventiy_k's user avatar
0 votes
0 answers
216 views

Node.js: bottlenecks when registering very large number of listeners and callbacks?

I'm working on an application where a single server might receive as many as 100,000 requests for the results of the same, slow-executing (up to 5s) process. That means an EventEmitter with a crap-...
tobek's user avatar
  • 4,539
1 vote
2 answers
146 views

How to run a function only after multiple functions have been resolved?

I have several functions which essentially prep up my app. once these prep functions have finished, i want to run the main loop of my app. So while the prep functions are async with each other, the ...
Rishav Sharan's user avatar
1 vote
1 answer
96 views

The best practice to force x clients to wait for the callback of client y in node.js

I'm trying to implement a cache system for a data-delivery tool for different clients with node.js. It's an http-service and I use express to handle the requests. My cache-system needs to support ...
iiiich's user avatar
  • 13
2 votes
1 answer
189 views

Node.js - Better way to manage javascript scopes between callbacks?

I'm working with Node.JS and have two objects that I move between via callbacks. I came up with a solution to maintain scope references to the correct object. I'm trying to figure out if there's a ...
Yelo Flux's user avatar

15 30 50 per page