How to use the fs-plus.isFileSync function in fs-plus

To help you get started, we’ve selected a few fs-plus 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 atom / archive-view / lib / archive-editor.js View on Github external
return atom.workspace.addOpener((filePath = '') => {
      // Check that filePath exists before opening, in case a remote URI was given
      if (isPathSupported(filePath) && fs.isFileSync(filePath)) {
        return new ArchiveEditor({path: filePath})
      }
    })
  }
github izuzak / atom-pdf-view / lib / pdf-editor.js View on Github external
export function deserialize({filePath, scale, scrollTop, scrollLeft}) {
  if (require('fs-plus').isFileSync(filePath)) {
    if (PdfEditorView === null) {
      PdfEditorView = require('./pdf-editor-view');
    }
    return new PdfEditorView(filePath, scale, scrollTop, scrollLeft);
  } else {
    console.warn("Could not deserialize PDF editor for path '#{filePath}' because that file no longer exists");
  }
}
github JunoLab / language-weave / lib / main.js View on Github external
export function deserialize({filePath, uri}) {
    if (require('fs-plus').isFileSync(filePath)) {
        return new HTMLPreviewView(uri)
    }
}
github t9md / atom-mprettier / lib / formatter.js View on Github external
const detectFile = filePath => {
    if (fs.isFileSync(filePath)) {
      libPath = filePath
    }
    return !!libPath
  }
  const detectInDirectory = (...dirs) => detectFile(Path.join(...dirs, 'node_modules', 'prettier', 'index.js'))
github jurassix / atom-javascript-refactor / lib / utils / renameFile.js View on Github external
function isNewPathValid(previousPath, nextPath) {
  if (!isFileSync(nextPath)) return true;

  /*
  New path exists so check if it points to the same file as the initial
  path to see if the case of the file name is being changed on a on a
  case insensitive filesystem.
  */
  const oldStat = statSync(previousPath);
  const newStat = statSync(nextPath);
  const haveSamePath = previousPath.toLowerCase() === nextPath.toLowerCase();
  const haveSameDev = oldStat.dev === newStat.dev;
  const haveSameIno = oldStat.ino === newStat.ino;

  return !(haveSamePath && haveSameDev && haveSameIno);
}

fs-plus

node's fs with more helpers

MIT
Latest version published 6 years ago

Package Health Score

50 / 100
Full package analysis