Articles tagged in: Node.js



Node.js — Securely Parse JSON

Node.js provides a global JSON object providing methods to parse a JSON string to JavaScript or stringify JavaScript values to a JSON string. The problem is that JavaScript’s global JSON object comes with a flaw allowing prototype pollution attacks. This tutorials shows you how to securely parse JSON …

Continue Reading

Node.js — Read a JSON File

JSON (JavaScript Object Notation) is a data format used across applications to share data. The applications can use different languages and they are able to share information using the JSON format. Node.js and NPM use a JSON file storing configuration details: the package.json file. Besides the package.json …

Continue Reading

Node.js — Detect if Running on Windows

Sometimes it’s necessary to detect the operating system running the Node.js process. Node.js comes with the built-in os module providing methods to detect the current platform. Use the methods to create a utility function detecting whether you’re currently running Node.js on Windows. {{outline}} Check if …

Continue Reading

Node.js — Detect if Running on macOS

Sometimes you need to detect the platform that runs your Node.js process. You can do that by using Node.js’ built-in os module. It provides a method returning the operating system and you can then compare the platform against macOS. {{outline}} Check if the Operating System is macOS The …

Continue Reading

Node.js — Detect if Running on Linux

In some situations, you need to detect the operating system running the Node.js process. You can do that by using Node.js’ built-in os module. {{outline}} Check if the Operating System is Linux The os module in Node.js provides a platform method. This platform method allows you to …

Continue Reading

Explore the Library

Find interesting tutorials and solutions for your problems.