How to use the web-ext-native-msg.createDirectory 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 startup = () => Promise.all([
  addProcessListeners(),
  createDirectory(TMPDIR_FILES, PERM_DIR),
  createDirectory(TMPDIR_FILES_PB, PERM_DIR),
]).then(exportAppStatus).catch(handleReject);
github asamuzaK / withExEditorHost / modules / main.js View on Github external
const initPrivateTmpDir = async bool => {
  if (bool) {
    fileMap[TMP_FILES_PB].clear();
    await removeDirectory(TMPDIR_FILES_PB, TMPDIR);
    await createDirectory(TMPDIR_FILES_PB, PERM_DIR);
  }
};
github asamuzaK / withExEditorHost / modules / main.js View on Github external
const createTmpFile = async (obj = {}) => {
  const {data, value} = obj;
  let filePath;
  if (data) {
    const {
      dataId, dir, extType, host, incognito, mode, syncAuto, tabId,
      windowId,
    } = data;
    if (dataId && dir && extType && host && tabId && windowId) {
      const dirPath = await createDirectory(
        path.join(TMPDIR_APP, dir, windowId, tabId, host), PERM_DIR,
      );
      const fileId = [windowId, tabId, host, dataId].join("_");
      const fileName = dataId && encodeURIComponent(dataId);
      filePath = dirPath && fileName && extType &&
        await createFile(path.join(dirPath, fileName + extType), value,
                         {encoding: CHAR, flag: "w", mode: PERM_FILE});
      filePath && dir && fileMap[dir] &&
        fileMap[dir].set(fileId, {data, filePath});
      if (!incognito && mode === MODE_EDIT && syncAuto) {
        const opt = {
          persistent: true,
          recursive: false,
          encoding: CHAR,
        };
        fileMap[FILE_WATCH].set(filePath, watch(filePath, opt, watchTmpFile));