Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const viewLocalFile = async uri => {
if (!isString(uri)) {
throw new TypeError(`Expected String but got ${getType(uri)}.`);
}
let func;
const {protocol} = new URL(uri);
if (protocol === "file:") {
const file = await convertUriToFilePath(uri);
if (file && isFile(file)) {
func = spawnChildProcess(file);
}
}
return func || null;
};