Creates a directory, if it does not exist.
fs.existsSync()
to check if the directory exists, fs.mkdirSync()
to create it.const fs = require('fs');
const createDirIfNotExists = dir =>
!fs.existsSync(dir) ? fs.mkdirSync(dir) : undefined;
createDirIfNotExists('test');
// creates the directory 'test', if it doesn't exist
JavaScript, Node
Creates a hash for a value using the SHA-256 algorithm. Returns a promise.
JavaScript, Node
Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.
JavaScript, Node
Loads a module after removing it from the cache (if exists).