Skip to content

Tag: node.js

require is not defined in Firebase?

I am trying to run a html file in Firebase staging environment. I have used Firebase npm package in the js code. But while running in the browser it throws error “require is not defined”. HTML Code: JS Code: Please suggest me some solution. Answer You need to setup a tool (such as webpack) to mana…

Pug – generating Select and Options

I am new to Pug and I am trying to generate a Select set of Options like this: However the result I get, in the rendered page, is an empty select input followed by the list of options as text Answer Indents the code https://pugjs.org/language/iteration.html

How to delete all pictures of an directory

I am trying to delete all pictures of an directory. But getting error on directory path. And also dont know how to get all pictures path & delete all of them. My directory structure : I have tried this : But getting error : Cannot find module ‘../tmp/upload’ Need help to get the path & all…

Check if file is completely written with node.js

I need a little bit help how I can handle following task in JavaScript: I have an app, that use Jimp for image processing and node-sprite-generator. That all runs in node.js context. I load a few images to Jimp, make something with the image then write it back to my file system with the nodejs filemodule. The…

Detect if node receives stdin

I’m interested in determining if my node script is being called with data being streamed into it or not. That is, I want to differentiate between these two cases Answer process.stdin.isTTY will be false when you have data piped to stdin: See docs: https://nodejs.org/api/tty.html