I’m trying to upload a file through Express File Upload but getting an undefined value of the function in which it is being called. I have this function which checks if the user chose a single file or multiple files. To keep it simple I am just going to show the issue in single file upload. That is req.…
Tag: node.js
Node: util.promisify() without callback as final parameter
I’m trying to use util.promisify() to transform a function that uses a callback so I can call it with async/await: https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_promisify_original So far I’ve been able to use it with functions that have the callback as the final parameter, as it…
Create a css file using node js [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 1 year ago. Improve this question I am b…
Discord Nickname Command with a specific format
I am relatively new to coding. I already coded a bot with a “nickname changer”. My problem is, that I want it to change to a specific format: “!nick @JohnDoe John” changes name to “JohnDoe [John]” It is for a private server, where everyone can see the users Gametag and thei…
NodeJS how to create a bash like input
I want to create a nodejs cli app, where there is a shell. I have tried doing this so far: But it only works once, how do I make it work continuously? Like so: Answer That is happening because you are only calling the question function once. To ask for next input you need to call it again inside the
What is the difference between “createReadStream” and “Readable” class?
Can someone explaint Difference between createReadStream and readable in node.js? By my observes they are similar, so what is under the hood difference, and when should each be used? for example this is similar to Answer In a NodeJS, you can create a readable stream in a few ways: SOLUTION 1 You can do it wit…
performing select query inside checkout function
I have this function with the following code below: I’m basically checking how much the user owes to me, and then redirecting to checkout. However, it is totally skipping over the query and not logging anything, and then throwing the error that no price is defined. This is because I am trying to set the…
node js sql output
I am trying to come up with the node.js code to get the output of this query: The problem is that when I use it without the connection.escape(), I get the output, but with single quotes like this: How can I (1) get rid of the (index) column, and (2) get rid of the single quotes? Getting rid of the
Is this valid syntax for node/promisify async function?
I accidentally typed await(await stat(content… and it worked. Not sure if this is valid syntax, or there is a better way to do it? I’m trying to read all the files that are directories and do not match my regex. Answer ls My advice would be not to put all of your eggs in one basket. We can write a…
How can I set the new Date to 1 minute later?
I made the second argument function of the schedule run one day later through the new Date. However, I want to change it in a minute, not in a day. How do I fix the code? this is my code Answer