MENU
  

API

  fs.mkdirSync("foo/bar/abc", { recursive: true })

  fs.readdirSync(dir).forEach((filename) => {
    const filePath = path.resolve(dir, filename)
  })

TLS proxy and CA Cert override

# allow node to make TLS connections where the cert is not trusted
NODE_TLS_REJECT_UNAUTHORIZED=0

# If you need to proxy TLS traffic originating in a node process though mitmproxy, you launch:
# mitmdump -p 8181 --set flow_detail=4
# And then load the mitmproxy CA cert as trusted in node using "ca" param in undici when you load the ProxyAgent:
import { fetch, ProxyAgent } from 'undici';
const ca = fs.readFileSync(path.join(os.homedir(), '.mitmproxy', 'mitmproxy-ca-cert.pem'));
const proxyAgent = new ProxyAgent({
  uri: 'http://localhost:8181',
  requestTls: { ca }
});
fetch(url, { ...init, dispatcher: proxyAgent })

# docs for the "ca" param passed to undici
https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions

npm

# How to see entire dependency tree with all transitive deps included?
npm ls --all

pnpm

pnpm up --interactive --latest

# How to see entire dependency tree with all transitive deps included?
pnpm ls -r --depth=Infinity