UNPKG

fast-extract

Version:

Extract contents from various archive types (tar, tar.bz2, tar.gz, tar.xz, tgz, zip)

22 lines (21 loc) 458 B
import { safeRmSync } from 'fs-remove-compat'; import onExit from 'signal-exit'; const fullPaths = []; onExit(()=>{ while(fullPaths.length){ try { safeRmSync(fullPaths.pop()); } catch (_err) {} } }); function add(fullPath) { fullPaths.push(fullPath); } function remove(fullPath) { const index = fullPaths.indexOf(fullPath); if (index >= 0) fullPaths.splice(index, 1); } export default { add, remove };