@gesslar/toolkit 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +3 -3
- package/src/lib/CappedDirectoryObject.js +4 -4
- package/src/lib/DirectoryObject.js +95 -25
- package/src/lib/TempDirectoryObject.js +8 -8
- package/src/types/lib/CappedDirectoryObject.d.ts +2 -2
- package/src/types/lib/DirectoryObject.d.ts +84 -23
- package/src/types/lib/DirectoryObject.d.ts.map +1 -1
- package/src/types/lib/TempDirectoryObject.d.ts +4 -4
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Includes all browser functionality plus Node.js-specific modules for file I/O, l
|
|
|
31
31
|
| Cache | Cache management for file I/O operations |
|
|
32
32
|
| CappedDirectoryObject | Directory operations constrained to a specific tree |
|
|
33
33
|
| Contract | Contract management and validation |
|
|
34
|
-
| DirectoryObject |
|
|
34
|
+
| DirectoryObject | Directory metadata and operations including path resolution, existence checks, and traversal |
|
|
35
35
|
| FileObject | File system wrapper for file operations |
|
|
36
36
|
| FS | Base class for file system operations with static utilities |
|
|
37
37
|
| Glog | Logging framework |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gesslar/toolkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A collection of utilities for Node.js and browser environments.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
],
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"engines": {
|
|
31
|
-
"node": ">=
|
|
31
|
+
"node": ">=22"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"types:build": "node -e \"require('fs').rmSync('src/types',{recursive:true,force:true});\" && tsc -p tsconfig.types.json",
|
|
35
35
|
"prepublishOnly": "npm run types:build",
|
|
36
36
|
"lint": "eslint src/",
|
|
37
37
|
"lint:fix": "eslint src/ --fix",
|
|
38
|
-
"submit": "npm publish --access public",
|
|
38
|
+
"submit": "npm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
39
39
|
"update": "npx npm-check-updates -u && npm install",
|
|
40
40
|
"test": "node --test tests/**/*.test.js",
|
|
41
41
|
"pr": "gt submit --publish --restack --ai"
|
|
@@ -169,10 +169,10 @@ export default class CappedDirectoryObject extends DirectoryObject {
|
|
|
169
169
|
* @throws {Sass} If the path contains traversal (..)
|
|
170
170
|
* @example
|
|
171
171
|
* const capped = new TempDirectoryObject("myapp")
|
|
172
|
-
* const subDir = capped.
|
|
172
|
+
* const subDir = capped.getDirectory("data")
|
|
173
173
|
* console.log(subDir.path) // "/tmp/myapp-ABC123/data"
|
|
174
174
|
*/
|
|
175
|
-
|
|
175
|
+
getDirectory(newPath) {
|
|
176
176
|
Valid.type(newPath, "String")
|
|
177
177
|
|
|
178
178
|
// Prevent absolute paths
|
|
@@ -203,10 +203,10 @@ export default class CappedDirectoryObject extends DirectoryObject {
|
|
|
203
203
|
* @throws {Sass} If the path contains traversal (..)
|
|
204
204
|
* @example
|
|
205
205
|
* const capped = new TempDirectoryObject("myapp")
|
|
206
|
-
* const file = capped.
|
|
206
|
+
* const file = capped.getFile("config.json")
|
|
207
207
|
* console.log(file.path) // "/tmp/myapp-ABC123/config.json"
|
|
208
208
|
*/
|
|
209
|
-
|
|
209
|
+
getFile(filename) {
|
|
210
210
|
Valid.type(filename, "String")
|
|
211
211
|
|
|
212
212
|
// Prevent absolute paths
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* resolution and existence checks.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {mkdir, opendir, readdir, rmdir} from "node:fs/promises"
|
|
7
|
+
import {glob, mkdir, opendir, readdir, rmdir} from "node:fs/promises"
|
|
8
8
|
import path from "node:path"
|
|
9
9
|
import {URL} from "node:url"
|
|
10
10
|
import util from "node:util"
|
|
@@ -16,17 +16,51 @@ import Sass from "./Sass.js"
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* DirectoryObject encapsulates metadata and operations for a directory,
|
|
19
|
-
*
|
|
19
|
+
* providing immutable path resolution, existence checks, and content enumeration.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
21
|
+
* Features:
|
|
22
|
+
* - Immutable metadata (path, name, URL) sealed on construction
|
|
23
|
+
* - Async existence checking and directory creation
|
|
24
|
+
* - Pattern-based content filtering with glob support
|
|
25
|
+
* - Path traversal via walkUp generator
|
|
26
|
+
* - Intelligent path merging for subdirectories and files
|
|
27
|
+
* - Support for temporary directory management
|
|
28
|
+
*
|
|
29
|
+
* @property {string} supplied - The original directory path as supplied to constructor
|
|
30
|
+
* @property {string} path - The absolute resolved directory path
|
|
31
|
+
* @property {URL} url - The directory as a file:// URL
|
|
32
|
+
* @property {string} name - The directory name (basename)
|
|
33
|
+
* @property {string} module - The directory name without extension (same as name for directories)
|
|
34
|
+
* @property {string} extension - The directory extension (typically empty string)
|
|
35
|
+
* @property {string} sep - Platform-specific path separator ('/' or '\\')
|
|
36
|
+
* @property {Array<string>} trail - Path segments split by separator
|
|
37
|
+
* @property {boolean} temporary - Whether this is marked as a temporary directory
|
|
38
|
+
* @property {boolean} isFile - Always false (this is a directory)
|
|
28
39
|
* @property {boolean} isDirectory - Always true
|
|
29
|
-
* @property {Promise<boolean>} exists - Whether the directory exists (async)
|
|
40
|
+
* @property {Promise<boolean>} exists - Whether the directory exists (async getter)
|
|
41
|
+
* @property {Generator<DirectoryObject>} walkUp - Generator yielding parent directories up to root
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Basic usage
|
|
45
|
+
* const dir = new DirectoryObject("/projects/myapp")
|
|
46
|
+
* console.log(dir.path) // "/projects/myapp"
|
|
47
|
+
* console.log(await dir.exists) // true/false
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Read directory contents
|
|
51
|
+
* const {files, directories} = await dir.read()
|
|
52
|
+
* const {files: jsFiles} = await dir.read("*.js")
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Path traversal
|
|
56
|
+
* for(const parent of dir.walkUp) {
|
|
57
|
+
* console.log(parent.path)
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Working with subdirectories and files
|
|
62
|
+
* const subDir = dir.getDirectory("src/lib")
|
|
63
|
+
* const file = dir.getFile("package.json")
|
|
30
64
|
*/
|
|
31
65
|
export default class DirectoryObject extends FS {
|
|
32
66
|
/**
|
|
@@ -289,12 +323,32 @@ export default class DirectoryObject extends FS {
|
|
|
289
323
|
}
|
|
290
324
|
|
|
291
325
|
/**
|
|
292
|
-
* Lists the contents of a directory.
|
|
326
|
+
* Lists the contents of a directory, optionally filtered by a glob pattern.
|
|
293
327
|
*
|
|
294
|
-
* @
|
|
328
|
+
* @async
|
|
329
|
+
* @param {string} [pat=""] - Optional glob pattern to filter results (e.g., "*.txt", "test-*")
|
|
330
|
+
* @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} Object containing arrays of files and directories
|
|
331
|
+
* @example
|
|
332
|
+
* const dir = new DirectoryObject("./src")
|
|
333
|
+
* const {files, directories} = await dir.read()
|
|
334
|
+
* console.log(files) // All files in ./src
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* // Filter for specific files
|
|
338
|
+
* const {files} = await dir.read("*.js")
|
|
339
|
+
* console.log(files) // Only .js files in ./src
|
|
295
340
|
*/
|
|
296
|
-
async read() {
|
|
297
|
-
const
|
|
341
|
+
async read(pat="") {
|
|
342
|
+
const cwd = this.path, withFileTypes = true
|
|
343
|
+
const found = !pat
|
|
344
|
+
? await readdir(this.url, {withFileTypes})
|
|
345
|
+
: await Array.fromAsync(
|
|
346
|
+
glob(pat, {
|
|
347
|
+
cwd,
|
|
348
|
+
withFileTypes,
|
|
349
|
+
exclude: candidate => candidate.parentPath !== cwd
|
|
350
|
+
})
|
|
351
|
+
)
|
|
298
352
|
|
|
299
353
|
const files = found
|
|
300
354
|
.filter(dirent => dirent.isFile())
|
|
@@ -443,17 +497,25 @@ export default class DirectoryObject extends FS {
|
|
|
443
497
|
/**
|
|
444
498
|
* Creates a new DirectoryObject by extending this directory's path.
|
|
445
499
|
*
|
|
446
|
-
* Uses
|
|
447
|
-
*
|
|
500
|
+
* Uses intelligent path merging that detects overlapping segments to avoid
|
|
501
|
+
* duplication (e.g., "/projects/toolkit" + "toolkit/src" = "/projects/toolkit/src").
|
|
502
|
+
* The temporary flag is preserved from the parent directory.
|
|
448
503
|
*
|
|
449
|
-
* @param {string} newPath - The path to append
|
|
450
|
-
* @returns {DirectoryObject} A new DirectoryObject with the
|
|
504
|
+
* @param {string} newPath - The subdirectory path to append (can be nested like "src/lib")
|
|
505
|
+
* @returns {DirectoryObject} A new DirectoryObject instance with the combined path
|
|
506
|
+
* @throws {Sass} If newPath is not a string
|
|
451
507
|
* @example
|
|
452
508
|
* const dir = new DirectoryObject("/projects/git/toolkit")
|
|
453
|
-
* const subDir = dir.
|
|
509
|
+
* const subDir = dir.getDirectory("src/lib")
|
|
454
510
|
* console.log(subDir.path) // "/projects/git/toolkit/src/lib"
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* // Handles overlapping segments intelligently
|
|
514
|
+
* const dir = new DirectoryObject("/projects/toolkit")
|
|
515
|
+
* const subDir = dir.getDirectory("toolkit/src")
|
|
516
|
+
* console.log(subDir.path) // "/projects/toolkit/src" (not /projects/toolkit/toolkit/src)
|
|
455
517
|
*/
|
|
456
|
-
|
|
518
|
+
getDirectory(newPath) {
|
|
457
519
|
Valid.type(newPath, "String")
|
|
458
520
|
|
|
459
521
|
const thisPath = this.path
|
|
@@ -465,16 +527,24 @@ export default class DirectoryObject extends FS {
|
|
|
465
527
|
/**
|
|
466
528
|
* Creates a new FileObject by extending this directory's path.
|
|
467
529
|
*
|
|
468
|
-
* Uses
|
|
530
|
+
* Uses intelligent path merging that detects overlapping segments to avoid
|
|
531
|
+
* duplication. The resulting FileObject can be used for reading, writing,
|
|
532
|
+
* and other file operations.
|
|
469
533
|
*
|
|
470
|
-
* @param {string} filename - The filename to append
|
|
471
|
-
* @returns {FileObject} A new FileObject with the
|
|
534
|
+
* @param {string} filename - The filename to append (can include subdirectories like "src/index.js")
|
|
535
|
+
* @returns {FileObject} A new FileObject instance with the combined path
|
|
536
|
+
* @throws {Sass} If filename is not a string
|
|
472
537
|
* @example
|
|
473
538
|
* const dir = new DirectoryObject("/projects/git/toolkit")
|
|
474
|
-
* const file = dir.
|
|
539
|
+
* const file = dir.getFile("package.json")
|
|
475
540
|
* console.log(file.path) // "/projects/git/toolkit/package.json"
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* // Can include nested paths
|
|
544
|
+
* const file = dir.getFile("src/index.js")
|
|
545
|
+
* const data = await file.read()
|
|
476
546
|
*/
|
|
477
|
-
|
|
547
|
+
getFile(filename) {
|
|
478
548
|
Valid.type(filename, "String")
|
|
479
549
|
|
|
480
550
|
const thisPath = this.path
|
|
@@ -109,12 +109,12 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
|
|
|
109
109
|
* @throws {Sass} If the path contains traversal (..)
|
|
110
110
|
* @example
|
|
111
111
|
* const temp = new TempDirectoryObject("myapp")
|
|
112
|
-
* const subDir = temp.
|
|
112
|
+
* const subDir = temp.getDirectory("data")
|
|
113
113
|
* console.log(subDir.path) // "/tmp/myapp-ABC123/data"
|
|
114
114
|
*/
|
|
115
|
-
|
|
116
|
-
// Delegate to base class
|
|
117
|
-
return super.
|
|
115
|
+
getDirectory(newPath) {
|
|
116
|
+
// Delegate to base class getDirectory() which will call TempDirectoryObject constructor
|
|
117
|
+
return super.getDirectory(newPath)
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
@@ -129,12 +129,12 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
|
|
|
129
129
|
* @throws {Sass} If the path contains traversal (..)
|
|
130
130
|
* @example
|
|
131
131
|
* const temp = new TempDirectoryObject("myapp")
|
|
132
|
-
* const file = temp.
|
|
132
|
+
* const file = temp.getFile("config.json")
|
|
133
133
|
* console.log(file.path) // "/tmp/myapp-ABC123/config.json"
|
|
134
134
|
*/
|
|
135
|
-
|
|
136
|
-
// Delegate to base class
|
|
137
|
-
return super.
|
|
135
|
+
getFile(filename) {
|
|
136
|
+
// Delegate to base class getFile() which handles security checks
|
|
137
|
+
return super.getFile(filename)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
@@ -50,10 +50,10 @@ export default class CappedDirectoryObject extends DirectoryObject {
|
|
|
50
50
|
* @throws {Sass} If the path contains traversal (..)
|
|
51
51
|
* @example
|
|
52
52
|
* const capped = new TempDirectoryObject("myapp")
|
|
53
|
-
* const subDir = capped.
|
|
53
|
+
* const subDir = capped.getDirectory("data")
|
|
54
54
|
* console.log(subDir.path) // "/tmp/myapp-ABC123/data"
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
getDirectory(newPath: string): CappedDirectoryObject;
|
|
57
57
|
#private;
|
|
58
58
|
}
|
|
59
59
|
import DirectoryObject from "./DirectoryObject.js";
|
|
@@ -1,16 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DirectoryObject encapsulates metadata and operations for a directory,
|
|
3
|
-
*
|
|
3
|
+
* providing immutable path resolution, existence checks, and content enumeration.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Immutable metadata (path, name, URL) sealed on construction
|
|
7
|
+
* - Async existence checking and directory creation
|
|
8
|
+
* - Pattern-based content filtering with glob support
|
|
9
|
+
* - Path traversal via walkUp generator
|
|
10
|
+
* - Intelligent path merging for subdirectories and files
|
|
11
|
+
* - Support for temporary directory management
|
|
12
|
+
*
|
|
13
|
+
* @property {string} supplied - The original directory path as supplied to constructor
|
|
14
|
+
* @property {string} path - The absolute resolved directory path
|
|
15
|
+
* @property {URL} url - The directory as a file:// URL
|
|
16
|
+
* @property {string} name - The directory name (basename)
|
|
17
|
+
* @property {string} module - The directory name without extension (same as name for directories)
|
|
18
|
+
* @property {string} extension - The directory extension (typically empty string)
|
|
19
|
+
* @property {string} sep - Platform-specific path separator ('/' or '\\')
|
|
20
|
+
* @property {Array<string>} trail - Path segments split by separator
|
|
21
|
+
* @property {boolean} temporary - Whether this is marked as a temporary directory
|
|
22
|
+
* @property {boolean} isFile - Always false (this is a directory)
|
|
12
23
|
* @property {boolean} isDirectory - Always true
|
|
13
|
-
* @property {Promise<boolean>} exists - Whether the directory exists (async)
|
|
24
|
+
* @property {Promise<boolean>} exists - Whether the directory exists (async getter)
|
|
25
|
+
* @property {Generator<DirectoryObject>} walkUp - Generator yielding parent directories up to root
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Basic usage
|
|
29
|
+
* const dir = new DirectoryObject("/projects/myapp")
|
|
30
|
+
* console.log(dir.path) // "/projects/myapp"
|
|
31
|
+
* console.log(await dir.exists) // true/false
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Read directory contents
|
|
35
|
+
* const {files, directories} = await dir.read()
|
|
36
|
+
* const {files: jsFiles} = await dir.read("*.js")
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Path traversal
|
|
40
|
+
* for(const parent of dir.walkUp) {
|
|
41
|
+
* console.log(parent.path)
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Working with subdirectories and files
|
|
46
|
+
* const subDir = dir.getDirectory("src/lib")
|
|
47
|
+
* const file = dir.getFile("package.json")
|
|
14
48
|
*/
|
|
15
49
|
export default class DirectoryObject extends FS {
|
|
16
50
|
[x: number]: () => object;
|
|
@@ -121,11 +155,22 @@ export default class DirectoryObject extends FS {
|
|
|
121
155
|
*/
|
|
122
156
|
get isDirectory(): boolean;
|
|
123
157
|
/**
|
|
124
|
-
* Lists the contents of a directory.
|
|
158
|
+
* Lists the contents of a directory, optionally filtered by a glob pattern.
|
|
125
159
|
*
|
|
126
|
-
* @
|
|
160
|
+
* @async
|
|
161
|
+
* @param {string} [pat=""] - Optional glob pattern to filter results (e.g., "*.txt", "test-*")
|
|
162
|
+
* @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} Object containing arrays of files and directories
|
|
163
|
+
* @example
|
|
164
|
+
* const dir = new DirectoryObject("./src")
|
|
165
|
+
* const {files, directories} = await dir.read()
|
|
166
|
+
* console.log(files) // All files in ./src
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* // Filter for specific files
|
|
170
|
+
* const {files} = await dir.read("*.js")
|
|
171
|
+
* console.log(files) // Only .js files in ./src
|
|
127
172
|
*/
|
|
128
|
-
read(): Promise<{
|
|
173
|
+
read(pat?: string): Promise<{
|
|
129
174
|
files: Array<FileObject>;
|
|
130
175
|
directories: Array<DirectoryObject>;
|
|
131
176
|
}>;
|
|
@@ -193,30 +238,46 @@ export default class DirectoryObject extends FS {
|
|
|
193
238
|
/**
|
|
194
239
|
* Creates a new DirectoryObject by extending this directory's path.
|
|
195
240
|
*
|
|
196
|
-
* Uses
|
|
197
|
-
*
|
|
241
|
+
* Uses intelligent path merging that detects overlapping segments to avoid
|
|
242
|
+
* duplication (e.g., "/projects/toolkit" + "toolkit/src" = "/projects/toolkit/src").
|
|
243
|
+
* The temporary flag is preserved from the parent directory.
|
|
198
244
|
*
|
|
199
|
-
* @param {string} newPath - The path to append
|
|
200
|
-
* @returns {DirectoryObject} A new DirectoryObject with the
|
|
245
|
+
* @param {string} newPath - The subdirectory path to append (can be nested like "src/lib")
|
|
246
|
+
* @returns {DirectoryObject} A new DirectoryObject instance with the combined path
|
|
247
|
+
* @throws {Sass} If newPath is not a string
|
|
201
248
|
* @example
|
|
202
249
|
* const dir = new DirectoryObject("/projects/git/toolkit")
|
|
203
|
-
* const subDir = dir.
|
|
250
|
+
* const subDir = dir.getDirectory("src/lib")
|
|
204
251
|
* console.log(subDir.path) // "/projects/git/toolkit/src/lib"
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* // Handles overlapping segments intelligently
|
|
255
|
+
* const dir = new DirectoryObject("/projects/toolkit")
|
|
256
|
+
* const subDir = dir.getDirectory("toolkit/src")
|
|
257
|
+
* console.log(subDir.path) // "/projects/toolkit/src" (not /projects/toolkit/toolkit/src)
|
|
205
258
|
*/
|
|
206
|
-
|
|
259
|
+
getDirectory(newPath: string): DirectoryObject;
|
|
207
260
|
/**
|
|
208
261
|
* Creates a new FileObject by extending this directory's path.
|
|
209
262
|
*
|
|
210
|
-
* Uses
|
|
263
|
+
* Uses intelligent path merging that detects overlapping segments to avoid
|
|
264
|
+
* duplication. The resulting FileObject can be used for reading, writing,
|
|
265
|
+
* and other file operations.
|
|
211
266
|
*
|
|
212
|
-
* @param {string} filename - The filename to append
|
|
213
|
-
* @returns {FileObject} A new FileObject with the
|
|
267
|
+
* @param {string} filename - The filename to append (can include subdirectories like "src/index.js")
|
|
268
|
+
* @returns {FileObject} A new FileObject instance with the combined path
|
|
269
|
+
* @throws {Sass} If filename is not a string
|
|
214
270
|
* @example
|
|
215
271
|
* const dir = new DirectoryObject("/projects/git/toolkit")
|
|
216
|
-
* const file = dir.
|
|
272
|
+
* const file = dir.getFile("package.json")
|
|
217
273
|
* console.log(file.path) // "/projects/git/toolkit/package.json"
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* // Can include nested paths
|
|
277
|
+
* const file = dir.getFile("src/index.js")
|
|
278
|
+
* const data = await file.read()
|
|
218
279
|
*/
|
|
219
|
-
|
|
280
|
+
getFile(filename: string): FileObject;
|
|
220
281
|
#private;
|
|
221
282
|
}
|
|
222
283
|
import FS from "./FS.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/DirectoryObject.js"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/DirectoryObject.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH;uBA4Fe,MAAM;IAjEnB;;;;;OAKG;IACH,yCAFW,OAAO,EA6BjB;IAWD;;;;OAIG;IACH,UAFa,MAAM,CAalB;IAWD;;;;OAIG;IACH,cAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;IAED;;;;OAIG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,WAFa,GAAG,CAIf;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,cAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,WAFa,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,aALa,KAAK,CAAC,MAAM,CAAC,CAOzB;IAED;;;;OAIG;IACH,iBAFa,OAAO,CAInB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,UATa,OAAO,CAAC,IAAI,CAAC,CA0BzB;IAED;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,mBAFa,OAAO,CAInB;IAiBD;;;;;;;;;;;;;;;OAeG;IACH,WAZW,MAAM,GACJ,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;KAAC,CAAC,CAoCpF;IAED;;;;;;;;;;;;OAYG;IACH,uBARW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAqBzB;IA8BD;;;;;;;;;;;;;;;OAeG;IACH,cAZa,MAAM,CAclB;IAED;;;;;;;;;;;;;;OAcG;IACH,UARa,OAAO,CAAC,IAAI,CAAC,CAkBzB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAM5B;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,sBAdW,MAAM,GACJ,eAAe,CAoB3B;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAbW,MAAM,GACJ,UAAU,CAmBtB;;CACF;eA9hBc,SAAS;uBACD,iBAAiB"}
|
|
@@ -56,10 +56,10 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
|
|
|
56
56
|
* @throws {Sass} If the path contains traversal (..)
|
|
57
57
|
* @example
|
|
58
58
|
* const temp = new TempDirectoryObject("myapp")
|
|
59
|
-
* const subDir = temp.
|
|
59
|
+
* const subDir = temp.getDirectory("data")
|
|
60
60
|
* console.log(subDir.path) // "/tmp/myapp-ABC123/data"
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
getDirectory(newPath: string): TempDirectoryObject;
|
|
63
63
|
/**
|
|
64
64
|
* Creates a new FileObject by extending this directory's path.
|
|
65
65
|
*
|
|
@@ -72,10 +72,10 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
|
|
|
72
72
|
* @throws {Sass} If the path contains traversal (..)
|
|
73
73
|
* @example
|
|
74
74
|
* const temp = new TempDirectoryObject("myapp")
|
|
75
|
-
* const file = temp.
|
|
75
|
+
* const file = temp.getFile("config.json")
|
|
76
76
|
* console.log(file.path) // "/tmp/myapp-ABC123/config.json"
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
getFile(filename: string): FileObject;
|
|
79
79
|
#private;
|
|
80
80
|
}
|
|
81
81
|
import CappedDirectoryObject from "./CappedDirectoryObject.js";
|