How to use the web-ext-native-msg.convertUriToFilePath function in web-ext-native-msg

To help you get started, we’ve selected a few web-ext-native-msg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asamuzaK / withExEditorHost / modules / main.js View on Github external
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;
};