Skip to content

Instantly share code, notes, and snippets.

danclarke / compress.js
Created March 20, 2017 00:44
Compress files in directory and sub directories using gzip and brotli
const brotli = require('brotli');
const zlib = require('zlib');
const fs = require('fs');
const path = require('path');
const compressDir = function (dir) {
console.log('Reading in: ' + dir);
fs.readdir(dir, function (err, files) {
if (err) {
console.error("Could not list the directory.", err);