Linked Questions
22 questions linked to/from How to write asynchronous functions for Node.js
1
vote
1
answer
151
views
How to make an Async API work? [duplicate]
I am currently developing an app for my institution and ran into the following problem.
I want to allow the user to check some things in database (currently using firebase). Since I have to check some ...
25
votes
10
answers
28k
views
how do i create a non-blocking asynchronous function in node.js?
How do I create a non-blocking asynchronous function? Below is what I'm trying to achieve but my program is still blocking...
var sys = require("sys");
function doSomething() {
sys.puts("why does ...
27
votes
3
answers
57k
views
Node.js how to read a file and then write the same file with two separate functions?
What I want to do is read a file and then be able to perform other operations with that information as I write the file. For example:
read file
write file and at the same time perform MD5 hash, ...
20
votes
4
answers
10k
views
Determine whether a method is synchronous or asynchronous
In node.js, is it possible to determine (using a function) whether a method is synchronous or asynchronous?
I'd like to write a function that does the following:
function isSynchonous(methodName) {
...
8
votes
3
answers
9k
views
How to have heavy processing operations done in node.js
I have a heavy data processing operation that I need to get done per 10-12 simultaneous requests. I have read that for a higher level of concurrency Node.js is a good platform and it achieves it by ...
4
votes
4
answers
2k
views
Is it possible somehow do multithreading in NodeJS?
So i'm have an app with Socket.IO which purpose is to search some data on different sites. Something like crawler... The main problem is that the search process is too long and while it happens my app ...
0
votes
1
answer
1k
views
How to send a return form a callback function to the main function
I have this fiddle http://jsfiddle.net/jdsans/38GFS/ which I was trying to workout but I could not send return for the callback function to the main function. The callback function contains end return ...
0
votes
2
answers
2k
views
Using more than one unirest requests with Sails
I have the following code
index: function (req, res) {
var Request = unirest.get("https://poker.p.mashape.com/index.php?players=4").headers({ "X-Mashape-Authorization": "xxxxxxxxxxxxxxxxx" }).end(...
-1
votes
1
answer
2k
views
Waiting until async call is done to proceed in Node
I'm trying to build a bot cluster, and I'm having some trouble here.
I'd like to call the following function, called BuildABot.
http://pastebin.com/zwP7rZay
Now after this call is finished, I'd ...
0
votes
2
answers
2k
views
Returning data from mongo within an express.js router function
I'm attempting to write a simple validation function that takes a mongo_id and checks to see if it exists. I am able to go this far, but I'm not able to pass that result back to the route that calls ...
0
votes
2
answers
1k
views
NodeJS Array is becoming undefined?
I'm implementing a web scraper using NodeJS with the Request and Cheerio libraries.
I'm trying to save the scraped URL links into an array, however, for some reason my array ends up becoming ...
-1
votes
1
answer
785
views
Async function doesn't work in global environment
I created sets of async functions in global environment. I want to re-use the async functions across all the modules. When I call the re-use async function in other module, it returned undefined.
...
2
votes
4
answers
208
views
How to make node works concurrently?
Node.js is famous for concurrency, however, I'm confused by how to make it work concurrently. I started two requests from Chrome one by one very quickly, and I Expected the outputs in console should ...
0
votes
2
answers
634
views
Return json from my parse function
I m trying to pull out a json from a function in a node.js script but nothing works
Here is the sample:
function parseJson()
{
return req = request(url, function(error,response,body)
{
...
0
votes
1
answer
361
views
Express - Can't set headers after they have been sent
I have the following route in my Express app that sets a cookie after a session has been written to the database. Then, after the session has been written the database, the route performs res.render ...