Tag: c

56 votes
28 answers
1.4K views
How can I print a circular structure in a JSON-like format?

I have a big object I want to convert to JSON and send. However it has circular structure. I want to toss what

avatar
Forrest
0 1 0 9
asked 07 September, 2021
61 votes
22 answers
3.1K views
How do I convert an existing callback API to promises?

I want to work with promises but I have a callback API in a format like: 1. DOM load or other one time event:

avatar
Nereida
0 1 0 9
asked 07 September, 2021
55 votes
24 answers
1.7K views
module.exports vs exports in Node.js

I've found the following contract in a Node.js module: module.exports = exports = nano = function databas

avatar
Scot
0 1 0 9
asked 07 September, 2021
51 votes
8 answers
1.7K views
Node.js: printing to console without a trailing newline?

Is there a method for printing to the console without a trailing newline? The console object documentation doe

avatar
User demo
0 1 0 9
asked 07 September, 2021
60 votes
11 answers
2.9K views
Node.js Best Practice Exception Handling

I just started trying out node.js a few days ago. I've realized that the Node is terminated whenever I ha

avatar
Omar
0 1 0 9
asked 07 September, 2021
65 votes
15 answers
1.3K views
How to list npm user-installed packages?

How do I list the user-installed package ONLY in npm? When I do npm -g list it outputs every package and their

avatar
Dario
0 1 0 9
asked 07 September, 2021
56 votes
25 answers
2K views
Upgrade Node.js to the latest version on Mac OS

Currently I am using Node.js v0.6.16 on Mac OS X 10.7.4. Now I want to upgrade it to the latest Node.js v0.8.1

avatar
Kurtis
0 1 0 9
asked 07 September, 2021
65 votes
23 answers
2.1K views
How to access POST form fields

Here is my simple form: <form id="loginformA" action="userlogin" method="post"> <div>

avatar
Kisha
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
1K views
Error: Can&apos;t set headers after they are sent to the client

I'm fairly new to Node.js and I am having some issues. I am using Node.js 4.10 and Express 2.4.3. When

avatar
Eddie
0 1 0 9
asked 07 September, 2021
57 votes
17 answers
3K views
What is the difference between --save and --save-dev?

What is the difference between: npm install [package_name] and: npm install [package_name] --save and: npm i

avatar
Forrest
0 1 0 9
asked 07 September, 2021
52 votes
7 answers
957 views
How can I do Base64 encoding in Node.js?

Does Node.js have built-in Base64 encoding yet? The reason why I ask this is that final() from crypto can only

avatar
Charis
0 1 0 9
asked 07 September, 2021
61 votes
17 answers
2.7K views
Sending command line arguments to npm script

The scripts portion of my package.json currently looks like this: "scripts": { "start": "node ./script.js

avatar
Kurtis
0 1 0 9
asked 07 September, 2021
54 votes
12 answers
1.2K views
Node.js + Nginx - What now?

I've set up Node.js and Nginx on my server. Now I want to use it, but, before I start there are 2 questio

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
60 votes
25 answers
1.5K views
In Node.js, how do I "include" functions from my other files?

Let's say I have a file called app.js. Pretty simple: var express = require('express'); var ap

avatar
Deedee
0 1 0 9
asked 07 September, 2021
61 votes
10 answers
1.1K views
Using Node.js require vs. ES6 import/export

In a project I'm collaborating on, we have two choices on which module system we can use: Importing modu

avatar
Chaya
0 1 0 9
asked 07 September, 2021
53 votes
17 answers
376 views
How can I get the full object in Node.js&apos;s console.log(), rather than &apos;[Object]&apos;?

When debugging using console.log(), how can I get the full object? const myObject = { "a":"a", "b":{

avatar
Royal
0 1 0 9
asked 07 September, 2021
67 votes
23 answers
1.7K views
Where does npm install packages?

Can someone tell me where can I find the Node.js modules, which I installed using npm?

avatar
Sydney
0 1 0 9
asked 07 September, 2021
58 votes
26 answers
2.7K views
How do you get a list of the names of all files present in a directory in Node.js?

I'm trying to get a list of the names of all the files present in a directory using Node.js. I want outp

avatar
Shantay
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
2.1K views
map function for objects (instead of arrays)

I have an object: myObject = { 'a': 1, 'b': 2, 'c': 3 } I am looking for a na

avatar
Dusty
0 1 0 9
asked 07 September, 2021
51 votes
7 answers
1.9K views
Read environment variables in Node.js

Is there a way to read environment variables in Node.js code? Like for example Python's os.environ[&apos

avatar
Joseph
0 1 0 9
asked 07 September, 2021