@mojojs/path
Advanced tools
+1
-1
| { | ||
| "name": "@mojojs/path", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "File system paths made fun", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+27
-0
@@ -100,2 +100,7 @@ <p align="center"> | ||
| const readable = new Path('test.txt').createReadStream({encoding: 'utf8'}); | ||
| // Read lines from file | ||
| for await (const line of new Path('test.txt').lines({encoding: 'UTF-8'})) { | ||
| console.log(line); | ||
| } | ||
| ``` | ||
@@ -156,2 +161,12 @@ | ||
| new Path('test').rmSync({recursive: true}); | ||
| // List files in directory | ||
| for await (const file of new Path('test').list()) { | ||
| console.log(file.toString()); | ||
| } | ||
| // List files recursively | ||
| for await (const file of new Path('test').list({recursive: true})) { | ||
| console.log(file.toString()); | ||
| } | ||
| ``` | ||
@@ -177,2 +192,14 @@ | ||
| ```js | ||
| // Check is file is a directory (async) | ||
| const stat = await new Path('test').stat(); | ||
| const isDirectory = stat.isDirectory(); | ||
| const lstat = await new Path('test').lstat(); | ||
| const isDirectory = lstat.isDirectory(); | ||
| // Check is file is a directory (sync) | ||
| const isDirectory = new Path('test').statSync().isDirectory(); | ||
| const isDirectory = new Path('test').lstatSync().isDirectory(); | ||
| ``` | ||
| ## Installation | ||
@@ -179,0 +206,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
20703
3.79%209
14.84%