aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@kwsites/file-exists/readme.md
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-02-12 10:33:06 +0100
committerMinteck <contact@minteck.org>2022-02-12 10:33:06 +0100
commit01160246e4a0c0052181c72a53737e356ea7d02d (patch)
treec6f8ea675f9147d4c06ef503697fb35d58493991 /node_modules/@kwsites/file-exists/readme.md
parentaf898a152a14e31bdbcbbedb952ad333697553ef (diff)
downloadtwilight-01160246e4a0c0052181c72a53737e356ea7d02d.tar.gz
twilight-01160246e4a0c0052181c72a53737e356ea7d02d.tar.bz2
twilight-01160246e4a0c0052181c72a53737e356ea7d02d.zip
First commit
Diffstat (limited to 'node_modules/@kwsites/file-exists/readme.md')
-rw-r--r--node_modules/@kwsites/file-exists/readme.md41
1 files changed, 41 insertions, 0 deletions
diff --git a/node_modules/@kwsites/file-exists/readme.md b/node_modules/@kwsites/file-exists/readme.md
new file mode 100644
index 0000000..0db6d0f
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/readme.md
@@ -0,0 +1,41 @@
+# @kwsites/file-exists
+
+Synchronous validation of a path existing either as a file or as a directory.
+
+```
+const { exists, FILE, FOLDER, READABLE } = require('@kwsites/file-exists');
+
+// check for a folder existing
+assert(exists(__dirname, FOLDER));
+assert(!exists(__filename, FOLDER));
+
+// check for a file existing
+assert(!exists(__filename, FILE));
+assert(exists(__filename, FILE));
+
+// when no type is specified, both folders and files are allowed
+assert(exists(__dirname));
+assert(exists(__filename));
+
+// alternatively specify both files and folders
+assert(exists(__dirname, FILE + FOLDER));
+
+// or just that the path is readable (can be either a file or folder)
+assert(exists(__filename, READABLE));
+```
+
+## Troubleshooting
+
+This library uses [debug](https://www.npmjs.com/package/debug) to handle logging,
+to enable logging, use either the environment variable:
+
+```
+"DEBUG=@kwsites/file-exists" node ./your-app.js
+```
+
+Or explicitly enable logging using the `debug` library itself:
+
+```javascript
+require('debug').enable('@kwsites/file-exists');
+```
+