@gesslar/toolkit 3.9.0 → 3.13.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/package.json +3 -3
- package/src/browser/lib/Data.js +89 -5
- package/src/browser/lib/TypeSpec.js +3 -1
- package/src/lib/CappedDirectoryObject.js +62 -484
- package/src/lib/DirectoryObject.js +86 -170
- package/src/lib/FS.js +221 -70
- package/src/lib/FileObject.js +80 -111
- package/src/lib/TempDirectoryObject.js +92 -141
- package/src/lib/Valid.js +1 -1
- package/src/types/browser/lib/Data.d.ts +46 -2
- package/src/types/browser/lib/Data.d.ts.map +1 -1
- package/src/types/browser/lib/TypeSpec.d.ts.map +1 -1
- package/src/types/lib/CappedDirectoryObject.d.ts +30 -55
- package/src/types/lib/CappedDirectoryObject.d.ts.map +1 -1
- package/src/types/lib/DirectoryObject.d.ts +8 -60
- package/src/types/lib/DirectoryObject.d.ts.map +1 -1
- package/src/types/lib/FS.d.ts +115 -15
- package/src/types/lib/FS.d.ts.map +1 -1
- package/src/types/lib/FileObject.d.ts +6 -10
- package/src/types/lib/FileObject.d.ts.map +1 -1
- package/src/types/lib/TempDirectoryObject.d.ts +15 -62
- package/src/types/lib/TempDirectoryObject.d.ts.map +1 -1
|
@@ -16,73 +16,26 @@ export default class TempDirectoryObject extends CappedDirectoryObject {
|
|
|
16
16
|
* @throws {Sass} Always throws an error
|
|
17
17
|
*/
|
|
18
18
|
static fromCwd(): void;
|
|
19
|
+
get isTemporary(): boolean;
|
|
20
|
+
get cap(): any;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Recursively removes a temporary directory and all its contents.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* This method will delete all files and subdirectories within this directory,
|
|
25
|
+
* then delete the directory itself. It only works on directories explicitly
|
|
26
|
+
* marked as temporary for safety.
|
|
24
27
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* If
|
|
28
|
-
*
|
|
29
|
-
* @param {string?} [name] - Base name for the temp directory (if empty/null, uses OS temp dir)
|
|
30
|
-
* @param {TempDirectoryObject?} [parent] - Optional parent temporary directory
|
|
31
|
-
* @throws {Sass} If name is absolute
|
|
32
|
-
* @throws {Sass} If name is empty (when parent is provided)
|
|
33
|
-
* @throws {Sass} If name contains path separators
|
|
34
|
-
* @throws {Sass} If parent is provided but not a temporary directory
|
|
35
|
-
* @throws {Sass} If parent's lineage does not trace back to the OS temp directory
|
|
36
|
-
* @throws {Sass} If directory creation fails
|
|
37
|
-
* @example
|
|
38
|
-
* // Use OS temp directory directly
|
|
39
|
-
* const temp = new TempDirectoryObject()
|
|
40
|
-
* console.log(temp.path) // "/tmp"
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* // Create with unique name
|
|
44
|
-
* const temp = new TempDirectoryObject("myapp")
|
|
45
|
-
* console.log(temp.path) // "/tmp/myapp-ABC123"
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* // Nested temp directories
|
|
49
|
-
* const parent = new TempDirectoryObject("parent")
|
|
50
|
-
* const child = new TempDirectoryObject("child", parent)
|
|
51
|
-
* await parent.remove() // Removes both parent and child
|
|
52
|
-
*/
|
|
53
|
-
constructor(name?: string | null, parent?: TempDirectoryObject | null);
|
|
54
|
-
/**
|
|
55
|
-
* Creates a new TempDirectoryObject by extending this directory's path.
|
|
56
|
-
*
|
|
57
|
-
* Validates that the resulting path remains within the temp directory tree.
|
|
58
|
-
*
|
|
59
|
-
* @param {string} newPath - The path segment to append
|
|
60
|
-
* @returns {TempDirectoryObject} A new TempDirectoryObject with the extended path
|
|
61
|
-
* @throws {Sass} If the path would escape the temp directory
|
|
62
|
-
* @throws {Sass} If the path is absolute
|
|
63
|
-
* @throws {Sass} If the path contains traversal (..)
|
|
64
|
-
* @example
|
|
65
|
-
* const temp = new TempDirectoryObject("myapp")
|
|
66
|
-
* const subDir = temp.getDirectory("data")
|
|
67
|
-
* console.log(subDir.path) // "/tmp/myapp-ABC123/data"
|
|
68
|
-
*/
|
|
69
|
-
getDirectory(newPath: string): TempDirectoryObject;
|
|
70
|
-
/**
|
|
71
|
-
* Creates a new FileObject by extending this directory's path.
|
|
72
|
-
*
|
|
73
|
-
* Validates that the resulting path remains within the temp directory tree.
|
|
74
|
-
*
|
|
75
|
-
* @param {string} filename - The filename to append
|
|
76
|
-
* @returns {FileObject} A new FileObject with the extended path
|
|
77
|
-
* @throws {Sass} If the path would escape the temp directory
|
|
78
|
-
* @throws {Sass} If the path is absolute
|
|
79
|
-
* @throws {Sass} If the path contains traversal (..)
|
|
28
|
+
* @async
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
* @throws {Sass} If the directory is not marked as temporary
|
|
31
|
+
* @throws {Sass} If the directory deletion fails
|
|
80
32
|
* @example
|
|
81
|
-
* const
|
|
82
|
-
*
|
|
83
|
-
*
|
|
33
|
+
* const tempDir = new TempDirectoryObject("my-temp")
|
|
34
|
+
* await tempDir.assureExists()
|
|
35
|
+
* // ... use the directory ...
|
|
36
|
+
* await tempDir.remove() // Recursively deletes everything
|
|
84
37
|
*/
|
|
85
|
-
|
|
38
|
+
remove(): Promise<void>;
|
|
86
39
|
#private;
|
|
87
40
|
}
|
|
88
41
|
import CappedDirectoryObject from "./CappedDirectoryObject.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TempDirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/TempDirectoryObject.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TempDirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/TempDirectoryObject.js"],"names":[],"mappings":"AAiBA;;;;;;;;;GASG;AACH;IAgIE;;;;;OAKG;IACH,uBAEC;IA1ED,2BAEC;IAwBD,eAEC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,UATa,OAAO,CAAC,IAAI,CAAC,CAWzB;;CA0BF;kCAzJiC,4BAA4B"}
|