Articles tagged in: Node.js



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

Node.js — Get a File‘s Extension

In some situations, you may need to retrieve the extension of a file on your local disk. Node.js comes with built-in functionality that you can use in your application. This tutorial shows you how to retrieve the file extension in Node.js. {{outline}} Retrieve the File Extension Node.js’ …

Continue Reading

Node.js — Get the Size of a File

Node.js ships with the native fs module to interact with the local file system. The fs module supports retrieving statistics for a file on your local disk. You may also get the size of a file from these statistics. This tutorial shows you how to retrieve the file size …

Continue Reading

Node.js — How to Download a File

You can download a file in Node.js in different ways. Node.js comes with built-in functions to download and save a file to your local disk. You can combine the integrated https and fs modules to download files from the Internet. This tutorial shows you how to use native …

Continue Reading

Explore the Library

Find interesting tutorials and solutions for your problems.