github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/action/node_modules/@kwsites/file-exists/readme.md (about)

     1  # @kwsites/file-exists
     2  
     3  Synchronous validation of a path existing either as a file or as a directory.
     4  
     5  ```
     6  const { exists, FILE, FOLDER, READABLE } = require('@kwsites/file-exists');
     7  
     8  // check for a folder existing
     9  assert(exists(__dirname, FOLDER));
    10  assert(!exists(__filename, FOLDER));
    11  
    12  // check for a file existing
    13  assert(!exists(__filename, FILE));
    14  assert(exists(__filename, FILE));
    15  
    16  // when no type is specified, both folders and files are allowed
    17  assert(exists(__dirname));
    18  assert(exists(__filename));
    19  
    20  // alternatively specify both files and folders
    21  assert(exists(__dirname, FILE + FOLDER));
    22  
    23  // or just that the path is readable (can be either a file or folder)
    24  assert(exists(__filename, READABLE));
    25  ```
    26  
    27  ## Troubleshooting
    28  
    29  This library uses [debug](https://www.npmjs.com/package/debug) to handle logging,
    30  to enable logging, use either the environment variable:
    31  
    32  ```
    33  "DEBUG=@kwsites/file-exists" node ./your-app.js 
    34  ``` 
    35  
    36  Or explicitly enable logging using the `debug` library itself:
    37  
    38  ```javascript
    39  require('debug').enable('@kwsites/file-exists');
    40  ``` 
    41