Skip to content

Instantly share code, notes, and snippets.

// npm i axios
const axios = require('axios').default;
axios.interceptors.request.use( x => {
// to avoid overwriting if another interceptor
// already defined the same object (meta)
x.meta = x.meta || {}
x.meta.requestStartedAt = new Date().getTime();
return x;
### Keybase proof
I hereby claim:
* I am jonathonjulian on github.
* I am jonathonfritz (https://keybase.io/jonathonfritz) on keybase.
* I have a public key ASA9CH8c30moDmkEWoZF3KkGFNim64ftpKmVYnE_BRe3jgo
To claim this, I am signing this object:
@JonathonJulian
JonathonJulian / gist:d8f50d89fd777ea9a19e917f64f830ab
Created November 28, 2018 22:25 — forked from AndrewRayCode/gist:825583
recursive read directory in node.js returning flattened list of files and directories
function readDir(start, callback) {
// Use lstat to resolve symlink if we are passed a symlink
fs.lstat(start, function(err, stat) {
if(err) {
return callback(err);
}
var found = {dirs: [], files: []},
total = 0,
processed = 0;
function isDir(abspath) {