Packages

npm packages particularly for the server

Default Node Packages

fs

  • Read relative to process.cwd()

const fs = require("fs");

fs.readFile(filePath, (err, content) => {
    //.....
});

Has promise version

const fs = require('fs').promises;

Check out fs-extra promise verison natively

Utils

Turn a callback style ft with (err, content) into promise returning content

const util = require('util');

const read = util.promisify(fs.readFile);

const data = await read('test.txt');

Extra

Debug

Create decorated/filterable log statements

To see http, export DEBUG=http environment variable with space/comma-delimited names, or export DEBUG=*

Can also use in browers then set localStorage.debug = 'worker:*'

cheerio

Fast, flexible & lean implementation of core jQuery designed specifically for the server.

node-cron

easy cron jobs

node-schedule

easy more advanced scheduler

Shells

run bash scripts

Notable Packages

Does

Write command line flag parsing like -d 1

Nodemailer

send mail

Last updated