UNPKG

tiny-open

Version:

A tiny utility for opening a file or a URL with its default application, or a custom one.

18 lines (17 loc) 400 B
/* IMPORT */ import { spawn } from 'node:child_process'; /* MAIN */ const spawnBin = (bin, args) => { return new Promise(resolve => { const process = spawn(bin, args, { detached: true, shell: false, windowsHide: true }); process.on('close', code => { resolve(!code); }); }); }; /* EXPORT */ export { spawnBin };