Skip to content

Tag: node.js

What does it mean by “message queue” in this link?

I was trying to understand what’s an event loop in JavaScript. Came across Mozilla Developer Network’s link about event loop. It mentions Queue A JavaScript runtime contains a message queue, which is a list of messages to be processed. To each message is associated a function. When the stack is empty, a message is taken out of the queue

How do you fetch and parse xml in node.js?

How do you fetch an xml from online with node.js and parse it into a javascript object? I’ve been searching the npm register but only found how to parse the xml-string, not how to fetch it. Answer To fetch an online resource, you can use http.get(). The data can be loaded into memory, or directly sent to a XML parser

Node.js project naming conventions for files & folders

What are the naming conventions for files and folders in a large Node.js project? Should I capitalize, camelCase, or under-score? Ie. is this considered valid? Answer After some years with node, I can say that there are no conventions for the directory/file structure. However most (professional) express applications use a setup like: An example which uses this setup is nodejs-starter.

How to change selenium user agent in selenium-webdriver nodejs land?

I’m in javascript + mocha + node land. I have tried setting userAgent and ‘user-agent’ as keys on capabilities: There is this answer which says to use a firefox profile, but that’s not exposed. There is no driver.FirefoxProfile nor one exposed globally nor webdriver.FirefoxProfile nor driver.profiles etc. I have tried Googling and looking the source and the documentation but there