pythonlib 1.0.1 → 2.0.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 +3 -1
- package/dist/base64-C_am75Sv.d.ts +165 -0
- package/dist/base64.d.ts +1 -0
- package/dist/base64.js +37 -0
- package/dist/chunk-2YTO24B5.js +78 -0
- package/dist/chunk-3CLXPGAB.js +237 -0
- package/dist/{chunk-H76SKASU.js → chunk-3M3PB4RO.js} +4 -6
- package/dist/chunk-5OKGPZBQ.js +1106 -0
- package/dist/chunk-5VAHUJNC.js +348 -0
- package/dist/chunk-B5AUEOAH.js +193 -0
- package/dist/chunk-B5LQJODJ.js +37 -0
- package/dist/{chunk-HQ42WNKZ.js → chunk-BCMGGBWG.js} +2 -5
- package/dist/chunk-BCVIH2BN.js +175 -0
- package/dist/{chunk-EE7SK2GV.js → chunk-D35YI363.js} +15 -12
- package/dist/{chunk-7TH4FCVQ.js → chunk-ETBW6XNR.js} +3 -4
- package/dist/chunk-FCJ7E4OE.js +250 -0
- package/dist/chunk-HSTC277I.js +255 -0
- package/dist/chunk-IANXD4D4.js +250 -0
- package/dist/{chunk-4KYJT3DR.js → chunk-JAUU3HMH.js} +1 -2
- package/dist/chunk-JJKTRIVO.js +262 -0
- package/dist/chunk-KKHKTQNN.js +361 -0
- package/dist/chunk-KKJHGY4C.js +551 -0
- package/dist/chunk-LHPQS75Z.js +192 -0
- package/dist/{chunk-LWO6BIAD.js → chunk-LK2L2TFG.js} +5 -6
- package/dist/chunk-LLZFLQS6.js +280 -0
- package/dist/chunk-LTXTS7RP.js +154 -0
- package/dist/{chunk-4QG3772L.js → chunk-LWYBTWBZ.js} +2 -3
- package/dist/{chunk-6ZAJ37MR.js → chunk-MFKIEN7N.js} +3 -3
- package/dist/{chunk-PZ5AY32C.js → chunk-MLKGABMK.js} +0 -1
- package/dist/chunk-OZRS5PC4.js +312 -0
- package/dist/chunk-PWA3YQZU.js +346 -0
- package/dist/{chunk-6POEDI34.js → chunk-QKJBQKPY.js} +1 -2
- package/dist/chunk-RB6BYCIQ.js +141 -0
- package/dist/chunk-U4X5DEIP.js +188 -0
- package/dist/chunk-UGZ5OY5Z.js +165 -0
- package/dist/chunk-WTZSAITC.js +82 -0
- package/dist/{collections-CJur5Wg-.d.ts → collections-BthXtkEp.d.ts} +5 -1
- package/dist/collections.d.ts +1 -1
- package/dist/collections.js +2 -3
- package/dist/copy-6ZaZ__ge.d.ts +59 -0
- package/dist/copy.d.ts +1 -0
- package/dist/copy.js +9 -0
- package/dist/{datetime-Bpce8gG2.d.ts → datetime-BM_IjhTq.d.ts} +3 -1
- package/dist/datetime.d.ts +1 -1
- package/dist/datetime.js +2 -3
- package/dist/{functools-NrsZAqJk.d.ts → functools-uIa5g75p.d.ts} +3 -1
- package/dist/functools.d.ts +1 -1
- package/dist/functools.js +2 -3
- package/dist/glob.browser-B6d_YdV5.d.ts +50 -0
- package/dist/glob.browser.d.ts +1 -0
- package/dist/glob.browser.js +15 -0
- package/dist/glob.node-wn5ehtyM.d.ts +80 -0
- package/dist/glob.node.d.ts +1 -0
- package/dist/glob.node.js +15 -0
- package/dist/hashlib-vKP511NY.d.ts +205 -0
- package/dist/hashlib.d.ts +1 -0
- package/dist/hashlib.js +39 -0
- package/dist/index.browser.d.ts +172 -0
- package/dist/index.browser.js +304 -0
- package/dist/index.d.ts +61 -437
- package/dist/index.js +138 -1115
- package/dist/{itertools-Sjl1LB_0.d.ts → itertools-T0rwOk2j.d.ts} +2 -4
- package/dist/itertools.d.ts +1 -1
- package/dist/itertools.js +2 -3
- package/dist/{json-DAlvCadU.d.ts → json-DoWhX04T.d.ts} +1 -0
- package/dist/json.d.ts +1 -1
- package/dist/json.js +2 -3
- package/dist/logging.browser-Dux4L5kz.d.ts +185 -0
- package/dist/logging.browser.d.ts +1 -0
- package/dist/logging.browser.js +63 -0
- package/dist/logging.node-CH75bVdE.d.ts +185 -0
- package/dist/logging.node.d.ts +1 -0
- package/dist/logging.node.js +61 -0
- package/dist/{math-DwEGjjQ-.d.ts → math-D2NPMc-x.d.ts} +2 -1
- package/dist/math.d.ts +1 -1
- package/dist/math.js +2 -3
- package/dist/{os-C6Nt7Ijx.d.ts → os.browser-krjSx5kF.d.ts} +32 -54
- package/dist/os.browser.d.ts +2 -0
- package/dist/{os.js → os.browser.js} +41 -16
- package/dist/os.node-CQjch8Ht.d.ts +124 -0
- package/dist/os.node.d.ts +2 -0
- package/dist/os.node.js +83 -0
- package/dist/os.shared-C3x70nhO.d.ts +59 -0
- package/dist/pathlib.browser-NC7kKQYe.d.ts +91 -0
- package/dist/pathlib.browser.d.ts +1 -0
- package/dist/pathlib.browser.js +17 -0
- package/dist/pathlib.node-CY3yUFdT.d.ts +331 -0
- package/dist/pathlib.node.d.ts +2 -0
- package/dist/pathlib.node.js +17 -0
- package/dist/{random-BJv_rSpL.d.ts → random-DcS5jtEs.d.ts} +3 -5
- package/dist/random.d.ts +1 -1
- package/dist/random.js +2 -3
- package/dist/{re-B1CHCgyr.d.ts → re-Bo-IOqov.d.ts} +3 -7
- package/dist/re.d.ts +1 -1
- package/dist/re.js +2 -3
- package/dist/set-JQbLAq8B.d.ts +592 -0
- package/dist/shutil.browser-Ck5oWhnP.d.ts +113 -0
- package/dist/shutil.browser.d.ts +1 -0
- package/dist/shutil.browser.js +33 -0
- package/dist/shutil.node-C9kwvhAf.d.ts +160 -0
- package/dist/shutil.node.d.ts +2 -0
- package/dist/shutil.node.js +33 -0
- package/dist/string.d.ts +3 -1
- package/dist/string.js +2 -3
- package/dist/subprocess-CZVYzQ3V.d.ts +214 -0
- package/dist/subprocess.d.ts +1 -0
- package/dist/subprocess.js +29 -0
- package/dist/sys-IL8LgI_W.d.ts +212 -0
- package/dist/sys.d.ts +1 -0
- package/dist/sys.js +51 -0
- package/dist/tempfile.browser-DciOKfNm.d.ts +78 -0
- package/dist/tempfile.browser.d.ts +1 -0
- package/dist/tempfile.browser.js +19 -0
- package/dist/tempfile.node-bVMY60Cu.d.ts +195 -0
- package/dist/tempfile.node.d.ts +2 -0
- package/dist/tempfile.node.js +23 -0
- package/dist/time-CcYhdiSu.d.ts +245 -0
- package/dist/time.d.ts +1 -0
- package/dist/time.js +49 -0
- package/dist/urllib-DJtkj-0f.d.ts +198 -0
- package/dist/urllib.d.ts +1 -0
- package/dist/urllib.js +37 -0
- package/dist/uuid-C0ypmn56.d.ts +160 -0
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +23 -0
- package/package.json +127 -5
- package/dist/chunk-4KYJT3DR.js.map +0 -1
- package/dist/chunk-4QG3772L.js.map +0 -1
- package/dist/chunk-6POEDI34.js.map +0 -1
- package/dist/chunk-6ZAJ37MR.js.map +0 -1
- package/dist/chunk-7TH4FCVQ.js.map +0 -1
- package/dist/chunk-CXKGPD5D.js +0 -313
- package/dist/chunk-CXKGPD5D.js.map +0 -1
- package/dist/chunk-EE7SK2GV.js.map +0 -1
- package/dist/chunk-H76SKASU.js.map +0 -1
- package/dist/chunk-HQ42WNKZ.js.map +0 -1
- package/dist/chunk-LWO6BIAD.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/collections.js.map +0 -1
- package/dist/datetime.js.map +0 -1
- package/dist/functools.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/itertools.js.map +0 -1
- package/dist/json.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/os.d.ts +0 -1
- package/dist/os.js.map +0 -1
- package/dist/random.js.map +0 -1
- package/dist/re.js.map +0 -1
- package/dist/string.js.map +0 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python sys module for TypeScript
|
|
3
|
+
*
|
|
4
|
+
* Provides access to system-specific parameters and functions.
|
|
5
|
+
* This module provides variables and functions that interact with the
|
|
6
|
+
* interpreter and its environment.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://docs.python.org/3/library/sys.html | Python sys documentation}
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Command line arguments passed to the script.
|
|
13
|
+
* Unlike Python, this excludes the Node.js executable and script path.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // node script.js arg1 arg2
|
|
18
|
+
* console.log(argv) // ["arg1", "arg2"]
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const argv: string[];
|
|
22
|
+
/**
|
|
23
|
+
* A string identifying the platform (operating system).
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* console.log(platform) // "darwin", "linux", "win32", etc.
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare const platform: string;
|
|
31
|
+
/**
|
|
32
|
+
* A string containing the version number of the Python interpreter (emulated).
|
|
33
|
+
* Returns a custom version string for pythonlib.
|
|
34
|
+
*/
|
|
35
|
+
declare const version = "3.11.0 (pythonlib TypeScript implementation)";
|
|
36
|
+
/**
|
|
37
|
+
* Version information as a named tuple-like object.
|
|
38
|
+
* Contains major, minor, micro, releaselevel, and serial components.
|
|
39
|
+
*/
|
|
40
|
+
declare const versionInfo: {
|
|
41
|
+
major: number;
|
|
42
|
+
minor: number;
|
|
43
|
+
micro: number;
|
|
44
|
+
releaselevel: "final";
|
|
45
|
+
serial: number;
|
|
46
|
+
0: number;
|
|
47
|
+
1: number;
|
|
48
|
+
2: number;
|
|
49
|
+
3: "final";
|
|
50
|
+
4: number;
|
|
51
|
+
length: number;
|
|
52
|
+
[Symbol.iterator]: () => Generator<number | "final", void, unknown>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Path to the interpreter executable (Node.js executable path).
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* console.log(executable) // "/usr/local/bin/node"
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare const executable: string;
|
|
63
|
+
/**
|
|
64
|
+
* A list of strings specifying the search path for modules.
|
|
65
|
+
* In Node.js context, this returns module.paths or an empty array.
|
|
66
|
+
*/
|
|
67
|
+
declare const path: string[];
|
|
68
|
+
/**
|
|
69
|
+
* Maximum value a variable of type Py_ssize_t can take.
|
|
70
|
+
* Equivalent to Number.MAX_SAFE_INTEGER in JavaScript.
|
|
71
|
+
*/
|
|
72
|
+
declare const maxsize: number;
|
|
73
|
+
/**
|
|
74
|
+
* Standard input stream.
|
|
75
|
+
*/
|
|
76
|
+
declare const stdin: NodeJS.ReadStream | null;
|
|
77
|
+
/**
|
|
78
|
+
* Standard output stream.
|
|
79
|
+
*/
|
|
80
|
+
declare const stdout: NodeJS.WriteStream | null;
|
|
81
|
+
/**
|
|
82
|
+
* Standard error stream.
|
|
83
|
+
*/
|
|
84
|
+
declare const stderr: NodeJS.WriteStream | null;
|
|
85
|
+
/**
|
|
86
|
+
* Exit from Python (terminate the process).
|
|
87
|
+
*
|
|
88
|
+
* @param code - Optional exit status code (default: 0 for success)
|
|
89
|
+
* @throws This function never returns; it terminates the process.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* exit() // Exit with success
|
|
94
|
+
* exit(1) // Exit with error code 1
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare function exit(code?: number): never;
|
|
98
|
+
/**
|
|
99
|
+
* Return the current recursion limit.
|
|
100
|
+
* In JavaScript, this is effectively unlimited, but we return a reasonable default.
|
|
101
|
+
*/
|
|
102
|
+
declare function getRecursionLimit(): number;
|
|
103
|
+
/**
|
|
104
|
+
* Set the maximum depth of the Python interpreter stack.
|
|
105
|
+
* This is a no-op in JavaScript as recursion is managed differently.
|
|
106
|
+
*
|
|
107
|
+
* @param limit - The new recursion limit
|
|
108
|
+
*/
|
|
109
|
+
declare function setRecursionLimit(limit: number): void;
|
|
110
|
+
/**
|
|
111
|
+
* Return the size of an object in bytes.
|
|
112
|
+
* This is an approximation as JavaScript doesn't provide exact memory sizes.
|
|
113
|
+
*
|
|
114
|
+
* @param obj - Object to measure
|
|
115
|
+
* @returns Approximate size in bytes
|
|
116
|
+
*/
|
|
117
|
+
declare function getSizeOf(obj: unknown): number;
|
|
118
|
+
/**
|
|
119
|
+
* Return the reference count for the object.
|
|
120
|
+
* JavaScript uses garbage collection, so this always returns a placeholder value.
|
|
121
|
+
*
|
|
122
|
+
* @param _obj - Object to check
|
|
123
|
+
* @returns Always returns 1 (reference counting not available in JS)
|
|
124
|
+
*/
|
|
125
|
+
declare function getRefCount(obj: unknown): number;
|
|
126
|
+
/**
|
|
127
|
+
* Return the default string encoding used by the Unicode implementation.
|
|
128
|
+
*/
|
|
129
|
+
declare function getDefaultEncoding(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Return the name of the encoding used to convert filenames.
|
|
132
|
+
*/
|
|
133
|
+
declare function getFilesystemEncoding(): string;
|
|
134
|
+
/**
|
|
135
|
+
* Integer specifying the API version, in Node.js context returns 0.
|
|
136
|
+
*/
|
|
137
|
+
declare const apiVersion = 0;
|
|
138
|
+
/**
|
|
139
|
+
* A string giving the site-specific directory prefix.
|
|
140
|
+
*/
|
|
141
|
+
declare const prefix: string;
|
|
142
|
+
/**
|
|
143
|
+
* Byte order indicator: "little" or "big".
|
|
144
|
+
*/
|
|
145
|
+
declare const byteorder: "little" | "big";
|
|
146
|
+
/**
|
|
147
|
+
* Float representation info (similar to Python's sys.float_info).
|
|
148
|
+
*/
|
|
149
|
+
declare const floatInfo: {
|
|
150
|
+
max: number;
|
|
151
|
+
maxExp: number;
|
|
152
|
+
max10Exp: number;
|
|
153
|
+
min: number;
|
|
154
|
+
minExp: number;
|
|
155
|
+
min10Exp: number;
|
|
156
|
+
dig: number;
|
|
157
|
+
mant_dig: number;
|
|
158
|
+
epsilon: number;
|
|
159
|
+
radix: number;
|
|
160
|
+
rounds: number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Integer representation info (similar to Python's sys.int_info).
|
|
164
|
+
*/
|
|
165
|
+
declare const intInfo: {
|
|
166
|
+
bitsPerDigit: number;
|
|
167
|
+
sizeofDigit: number;
|
|
168
|
+
defaultMaxStrDigits: number;
|
|
169
|
+
strDigitsCheckThreshold: number;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Hash implementation info.
|
|
173
|
+
*/
|
|
174
|
+
declare const hashInfo: {
|
|
175
|
+
width: number;
|
|
176
|
+
modulus: bigint;
|
|
177
|
+
inf: number;
|
|
178
|
+
nan: number;
|
|
179
|
+
imag: number;
|
|
180
|
+
algorithm: string;
|
|
181
|
+
hashBits: number;
|
|
182
|
+
seedBits: number;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
declare const sysModule_apiVersion: typeof apiVersion;
|
|
186
|
+
declare const sysModule_argv: typeof argv;
|
|
187
|
+
declare const sysModule_byteorder: typeof byteorder;
|
|
188
|
+
declare const sysModule_executable: typeof executable;
|
|
189
|
+
declare const sysModule_exit: typeof exit;
|
|
190
|
+
declare const sysModule_floatInfo: typeof floatInfo;
|
|
191
|
+
declare const sysModule_getDefaultEncoding: typeof getDefaultEncoding;
|
|
192
|
+
declare const sysModule_getFilesystemEncoding: typeof getFilesystemEncoding;
|
|
193
|
+
declare const sysModule_getRecursionLimit: typeof getRecursionLimit;
|
|
194
|
+
declare const sysModule_getRefCount: typeof getRefCount;
|
|
195
|
+
declare const sysModule_getSizeOf: typeof getSizeOf;
|
|
196
|
+
declare const sysModule_hashInfo: typeof hashInfo;
|
|
197
|
+
declare const sysModule_intInfo: typeof intInfo;
|
|
198
|
+
declare const sysModule_maxsize: typeof maxsize;
|
|
199
|
+
declare const sysModule_path: typeof path;
|
|
200
|
+
declare const sysModule_platform: typeof platform;
|
|
201
|
+
declare const sysModule_prefix: typeof prefix;
|
|
202
|
+
declare const sysModule_setRecursionLimit: typeof setRecursionLimit;
|
|
203
|
+
declare const sysModule_stderr: typeof stderr;
|
|
204
|
+
declare const sysModule_stdin: typeof stdin;
|
|
205
|
+
declare const sysModule_stdout: typeof stdout;
|
|
206
|
+
declare const sysModule_version: typeof version;
|
|
207
|
+
declare const sysModule_versionInfo: typeof versionInfo;
|
|
208
|
+
declare namespace sysModule {
|
|
209
|
+
export { sysModule_apiVersion as apiVersion, sysModule_argv as argv, sysModule_byteorder as byteorder, sysModule_executable as executable, sysModule_exit as exit, sysModule_floatInfo as floatInfo, sysModule_getDefaultEncoding as getDefaultEncoding, sysModule_getFilesystemEncoding as getFilesystemEncoding, sysModule_getRecursionLimit as getRecursionLimit, sysModule_getRefCount as getRefCount, sysModule_getSizeOf as getSizeOf, sysModule_hashInfo as hashInfo, sysModule_intInfo as intInfo, sysModule_maxsize as maxsize, sysModule_path as path, sysModule_platform as platform, sysModule_prefix as prefix, sysModule_setRecursionLimit as setRecursionLimit, sysModule_stderr as stderr, sysModule_stdin as stdin, sysModule_stdout as stdout, sysModule_version as version, sysModule_versionInfo as versionInfo };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export { argv as a, versionInfo as b, path as c, stdin as d, executable as e, stdout as f, stderr as g, exit as h, getRecursionLimit as i, setRecursionLimit as j, getSizeOf as k, getRefCount as l, maxsize as m, getDefaultEncoding as n, getFilesystemEncoding as o, platform as p, apiVersion as q, prefix as r, sysModule as s, byteorder as t, floatInfo as u, version as v, intInfo as w, hashInfo as x };
|
package/dist/sys.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { q as apiVersion, a as argv, t as byteorder, e as executable, h as exit, u as floatInfo, n as getDefaultEncoding, o as getFilesystemEncoding, i as getRecursionLimit, l as getRefCount, k as getSizeOf, x as hashInfo, w as intInfo, m as maxsize, c as path, p as platform, r as prefix, j as setRecursionLimit, g as stderr, d as stdin, f as stdout, v as version, b as versionInfo } from './sys-IL8LgI_W.js';
|
package/dist/sys.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiVersion,
|
|
3
|
+
argv,
|
|
4
|
+
byteorder,
|
|
5
|
+
executable,
|
|
6
|
+
exit,
|
|
7
|
+
floatInfo,
|
|
8
|
+
getDefaultEncoding,
|
|
9
|
+
getFilesystemEncoding,
|
|
10
|
+
getRecursionLimit,
|
|
11
|
+
getRefCount,
|
|
12
|
+
getSizeOf,
|
|
13
|
+
hashInfo,
|
|
14
|
+
intInfo,
|
|
15
|
+
maxsize,
|
|
16
|
+
path,
|
|
17
|
+
platform,
|
|
18
|
+
prefix,
|
|
19
|
+
setRecursionLimit,
|
|
20
|
+
stderr,
|
|
21
|
+
stdin,
|
|
22
|
+
stdout,
|
|
23
|
+
version,
|
|
24
|
+
versionInfo
|
|
25
|
+
} from "./chunk-U4X5DEIP.js";
|
|
26
|
+
import "./chunk-MLKGABMK.js";
|
|
27
|
+
export {
|
|
28
|
+
apiVersion,
|
|
29
|
+
argv,
|
|
30
|
+
byteorder,
|
|
31
|
+
executable,
|
|
32
|
+
exit,
|
|
33
|
+
floatInfo,
|
|
34
|
+
getDefaultEncoding,
|
|
35
|
+
getFilesystemEncoding,
|
|
36
|
+
getRecursionLimit,
|
|
37
|
+
getRefCount,
|
|
38
|
+
getSizeOf,
|
|
39
|
+
hashInfo,
|
|
40
|
+
intInfo,
|
|
41
|
+
maxsize,
|
|
42
|
+
path,
|
|
43
|
+
platform,
|
|
44
|
+
prefix,
|
|
45
|
+
setRecursionLimit,
|
|
46
|
+
stderr,
|
|
47
|
+
stdin,
|
|
48
|
+
stdout,
|
|
49
|
+
version,
|
|
50
|
+
versionInfo
|
|
51
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python tempfile module for TypeScript - Browser version
|
|
3
|
+
*
|
|
4
|
+
* Browser stub - temporary file operations are not available.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://docs.python.org/3/library/tempfile.html | Python tempfile documentation}
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Return the name of the directory used for temporary files.
|
|
11
|
+
*/
|
|
12
|
+
declare function getTempDir(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Return the default prefix for temporary names.
|
|
15
|
+
*/
|
|
16
|
+
declare function getPrefix(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Generate a unique temporary file path (does not create the file).
|
|
19
|
+
* Browser stub - returns a path that would be used in Node.js.
|
|
20
|
+
*/
|
|
21
|
+
declare function mktemp(suffix?: string, prefix?: string, dir?: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Create a temporary file and return [handle, path].
|
|
24
|
+
* Browser stub - throws error.
|
|
25
|
+
*/
|
|
26
|
+
declare function mkstemp(_suffix?: string, _prefix?: string, _dir?: string): Promise<[unknown, string]>;
|
|
27
|
+
/**
|
|
28
|
+
* Create a temporary directory and return its path.
|
|
29
|
+
* Browser stub - throws error.
|
|
30
|
+
*/
|
|
31
|
+
declare function mkdtemp(_suffix?: string, _prefix?: string, _dir?: string): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Named temporary file - Browser stub.
|
|
34
|
+
*/
|
|
35
|
+
declare class NamedTemporaryFile {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly deleteOnClose: boolean;
|
|
38
|
+
private constructor();
|
|
39
|
+
static create(_options?: {
|
|
40
|
+
mode?: string;
|
|
41
|
+
suffix?: string;
|
|
42
|
+
prefix?: string;
|
|
43
|
+
dir?: string;
|
|
44
|
+
delete?: boolean;
|
|
45
|
+
}): Promise<NamedTemporaryFile>;
|
|
46
|
+
write(_data: string | Uint8Array): Promise<number>;
|
|
47
|
+
read(_size?: number): Promise<Uint8Array>;
|
|
48
|
+
flush(): Promise<void>;
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Temporary directory - Browser stub.
|
|
53
|
+
*/
|
|
54
|
+
declare class TemporaryDirectory {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
private constructor();
|
|
57
|
+
static create(_options?: {
|
|
58
|
+
suffix?: string;
|
|
59
|
+
prefix?: string;
|
|
60
|
+
dir?: string;
|
|
61
|
+
}): Promise<TemporaryDirectory>;
|
|
62
|
+
cleanup(): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type tempfileModule_NamedTemporaryFile = NamedTemporaryFile;
|
|
66
|
+
declare const tempfileModule_NamedTemporaryFile: typeof NamedTemporaryFile;
|
|
67
|
+
type tempfileModule_TemporaryDirectory = TemporaryDirectory;
|
|
68
|
+
declare const tempfileModule_TemporaryDirectory: typeof TemporaryDirectory;
|
|
69
|
+
declare const tempfileModule_getPrefix: typeof getPrefix;
|
|
70
|
+
declare const tempfileModule_getTempDir: typeof getTempDir;
|
|
71
|
+
declare const tempfileModule_mkdtemp: typeof mkdtemp;
|
|
72
|
+
declare const tempfileModule_mkstemp: typeof mkstemp;
|
|
73
|
+
declare const tempfileModule_mktemp: typeof mktemp;
|
|
74
|
+
declare namespace tempfileModule {
|
|
75
|
+
export { tempfileModule_NamedTemporaryFile as NamedTemporaryFile, tempfileModule_TemporaryDirectory as TemporaryDirectory, tempfileModule_getPrefix as getPrefix, tempfileModule_getTempDir as getTempDir, tempfileModule_mkdtemp as mkdtemp, tempfileModule_mkstemp as mkstemp, tempfileModule_mktemp as mktemp };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { NamedTemporaryFile as N, TemporaryDirectory as T, getPrefix as a, mkstemp as b, mkdtemp as c, getTempDir as g, mktemp as m, tempfileModule as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { N as NamedTemporaryFile, T as TemporaryDirectory, a as getPrefix, g as getTempDir, c as mkdtemp, b as mkstemp, m as mktemp } from './tempfile.browser-DciOKfNm.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NamedTemporaryFile,
|
|
3
|
+
TemporaryDirectory,
|
|
4
|
+
getPrefix,
|
|
5
|
+
getTempDir,
|
|
6
|
+
mkdtemp,
|
|
7
|
+
mkstemp,
|
|
8
|
+
mktemp
|
|
9
|
+
} from "./chunk-2YTO24B5.js";
|
|
10
|
+
import "./chunk-MLKGABMK.js";
|
|
11
|
+
export {
|
|
12
|
+
NamedTemporaryFile,
|
|
13
|
+
TemporaryDirectory,
|
|
14
|
+
getPrefix,
|
|
15
|
+
getTempDir,
|
|
16
|
+
mkdtemp,
|
|
17
|
+
mkstemp,
|
|
18
|
+
mktemp
|
|
19
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { FileHandle } from 'node:fs/promises';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Python tempfile module for TypeScript
|
|
5
|
+
*
|
|
6
|
+
* Provides async functions for creating temporary files and directories.
|
|
7
|
+
* All filesystem operations use the async fs/promises API.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link https://docs.python.org/3/library/tempfile.html | Python tempfile documentation}
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Return the default directory for temporary files.
|
|
15
|
+
*
|
|
16
|
+
* @returns The temporary directory path
|
|
17
|
+
*/
|
|
18
|
+
declare function gettempdir(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a unique temporary file path (but don't create the file).
|
|
21
|
+
*
|
|
22
|
+
* Note: This is deprecated in Python but still useful in some cases.
|
|
23
|
+
* Consider using mkstemp() or NamedTemporaryFile() instead.
|
|
24
|
+
*
|
|
25
|
+
* @param suffix - Optional suffix for the filename
|
|
26
|
+
* @param prefix - Optional prefix for the filename (default: "tmp")
|
|
27
|
+
* @param dir - Optional directory (default: system temp dir)
|
|
28
|
+
* @returns Path to the temporary file
|
|
29
|
+
*/
|
|
30
|
+
declare function mktemp(suffix?: string, prefix?: string, dir?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Create a temporary file and return a tuple of (handle, path).
|
|
33
|
+
*
|
|
34
|
+
* @param suffix - Optional suffix for the filename
|
|
35
|
+
* @param prefix - Optional prefix for the filename (default: "tmp")
|
|
36
|
+
* @param dir - Optional directory (default: system temp dir)
|
|
37
|
+
* @param text - If true, open in text mode (default: false)
|
|
38
|
+
* @returns Promise of tuple [FileHandle, path]
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const [handle, path] = await mkstemp(".txt", "myapp-")
|
|
43
|
+
* await handle.write(Buffer.from("data"))
|
|
44
|
+
* await handle.close()
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function mkstemp(suffix?: string, prefix?: string, dir?: string, _text?: boolean): Promise<[FileHandle, string]>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a temporary directory and return its path.
|
|
50
|
+
*
|
|
51
|
+
* @param suffix - Optional suffix for the directory name
|
|
52
|
+
* @param prefix - Optional prefix for the directory name (default: "tmp")
|
|
53
|
+
* @param dir - Optional parent directory (default: system temp dir)
|
|
54
|
+
* @returns Promise of path to the created directory
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const dir = await mkdtemp("", "myapp-")
|
|
59
|
+
* // Use directory...
|
|
60
|
+
* await rm(dir, { recursive: true })
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare function mkdtemp(suffix?: string, prefix?: string, dir?: string): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* A named temporary file with async operations.
|
|
66
|
+
*
|
|
67
|
+
* Use the static `create()` method to instantiate (constructors cannot be async).
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const tmp = await NamedTemporaryFile.create({ suffix: ".txt" })
|
|
72
|
+
* await tmp.write("hello world")
|
|
73
|
+
* await tmp.close() // File is deleted if deleteOnClose is true
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare class NamedTemporaryFile {
|
|
77
|
+
/** The file handle */
|
|
78
|
+
readonly handle: FileHandle;
|
|
79
|
+
/** The file path */
|
|
80
|
+
readonly name: string;
|
|
81
|
+
/** Whether to delete the file on close */
|
|
82
|
+
readonly deleteOnClose: boolean;
|
|
83
|
+
private _closed;
|
|
84
|
+
private constructor();
|
|
85
|
+
/**
|
|
86
|
+
* Create a new NamedTemporaryFile.
|
|
87
|
+
*/
|
|
88
|
+
static create(options?: {
|
|
89
|
+
suffix?: string;
|
|
90
|
+
prefix?: string;
|
|
91
|
+
dir?: string;
|
|
92
|
+
delete?: boolean;
|
|
93
|
+
mode?: string;
|
|
94
|
+
}): Promise<NamedTemporaryFile>;
|
|
95
|
+
/**
|
|
96
|
+
* Write data to the file.
|
|
97
|
+
*/
|
|
98
|
+
write(data: string | Uint8Array): Promise<number>;
|
|
99
|
+
/**
|
|
100
|
+
* Read data from the file.
|
|
101
|
+
*/
|
|
102
|
+
read(size?: number): Promise<Buffer>;
|
|
103
|
+
/**
|
|
104
|
+
* Seek to a position in the file.
|
|
105
|
+
*/
|
|
106
|
+
seek(_offset: number, _whence?: number): void;
|
|
107
|
+
/**
|
|
108
|
+
* Flush the file buffer.
|
|
109
|
+
*/
|
|
110
|
+
flush(): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Close the file.
|
|
113
|
+
*/
|
|
114
|
+
close(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Check if the file is closed.
|
|
117
|
+
*/
|
|
118
|
+
get closed(): boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A temporary directory that cleans itself up.
|
|
122
|
+
*
|
|
123
|
+
* Use the static `create()` method to instantiate (constructors cannot be async).
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const tmp = await TemporaryDirectory.create({ prefix: "myapp-" })
|
|
128
|
+
* // Use tmp.name as directory path...
|
|
129
|
+
* await tmp.cleanup() // Removes directory and contents
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
declare class TemporaryDirectory {
|
|
133
|
+
/** The directory path */
|
|
134
|
+
readonly name: string;
|
|
135
|
+
private _cleaned;
|
|
136
|
+
private constructor();
|
|
137
|
+
/**
|
|
138
|
+
* Create a new TemporaryDirectory.
|
|
139
|
+
*/
|
|
140
|
+
static create(options?: {
|
|
141
|
+
suffix?: string;
|
|
142
|
+
prefix?: string;
|
|
143
|
+
dir?: string;
|
|
144
|
+
}): Promise<TemporaryDirectory>;
|
|
145
|
+
/**
|
|
146
|
+
* Remove the temporary directory and its contents.
|
|
147
|
+
*/
|
|
148
|
+
cleanup(): Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Create a temporary file that is automatically deleted when closed.
|
|
152
|
+
*
|
|
153
|
+
* @param options - Options for creating the file
|
|
154
|
+
* @returns Promise of NamedTemporaryFile object
|
|
155
|
+
*/
|
|
156
|
+
declare function namedTemporaryFile(options?: {
|
|
157
|
+
suffix?: string;
|
|
158
|
+
prefix?: string;
|
|
159
|
+
dir?: string;
|
|
160
|
+
delete?: boolean;
|
|
161
|
+
mode?: string;
|
|
162
|
+
}): Promise<NamedTemporaryFile>;
|
|
163
|
+
/**
|
|
164
|
+
* Create a temporary directory that is automatically cleaned up.
|
|
165
|
+
*
|
|
166
|
+
* @param options - Options for creating the directory
|
|
167
|
+
* @returns Promise of TemporaryDirectory object
|
|
168
|
+
*/
|
|
169
|
+
declare function temporaryDirectory(options?: {
|
|
170
|
+
suffix?: string;
|
|
171
|
+
prefix?: string;
|
|
172
|
+
dir?: string;
|
|
173
|
+
}): Promise<TemporaryDirectory>;
|
|
174
|
+
/**
|
|
175
|
+
* Return the name of the file used to store temporary file names.
|
|
176
|
+
* This is platform-specific and may not exist on all systems.
|
|
177
|
+
*/
|
|
178
|
+
declare function gettempprefix(): string;
|
|
179
|
+
|
|
180
|
+
type tempfileModule_NamedTemporaryFile = NamedTemporaryFile;
|
|
181
|
+
declare const tempfileModule_NamedTemporaryFile: typeof NamedTemporaryFile;
|
|
182
|
+
type tempfileModule_TemporaryDirectory = TemporaryDirectory;
|
|
183
|
+
declare const tempfileModule_TemporaryDirectory: typeof TemporaryDirectory;
|
|
184
|
+
declare const tempfileModule_gettempdir: typeof gettempdir;
|
|
185
|
+
declare const tempfileModule_gettempprefix: typeof gettempprefix;
|
|
186
|
+
declare const tempfileModule_mkdtemp: typeof mkdtemp;
|
|
187
|
+
declare const tempfileModule_mkstemp: typeof mkstemp;
|
|
188
|
+
declare const tempfileModule_mktemp: typeof mktemp;
|
|
189
|
+
declare const tempfileModule_namedTemporaryFile: typeof namedTemporaryFile;
|
|
190
|
+
declare const tempfileModule_temporaryDirectory: typeof temporaryDirectory;
|
|
191
|
+
declare namespace tempfileModule {
|
|
192
|
+
export { tempfileModule_NamedTemporaryFile as NamedTemporaryFile, tempfileModule_TemporaryDirectory as TemporaryDirectory, tempfileModule_gettempdir as gettempdir, tempfileModule_gettempprefix as gettempprefix, tempfileModule_mkdtemp as mkdtemp, tempfileModule_mkstemp as mkstemp, tempfileModule_mktemp as mktemp, tempfileModule_namedTemporaryFile as namedTemporaryFile, tempfileModule_temporaryDirectory as temporaryDirectory };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export { NamedTemporaryFile as N, TemporaryDirectory as T, mkstemp as a, mkdtemp as b, temporaryDirectory as c, gettempprefix as d, gettempdir as g, mktemp as m, namedTemporaryFile as n, tempfileModule as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NamedTemporaryFile,
|
|
3
|
+
TemporaryDirectory,
|
|
4
|
+
gettempdir,
|
|
5
|
+
gettempprefix,
|
|
6
|
+
mkdtemp,
|
|
7
|
+
mkstemp,
|
|
8
|
+
mktemp,
|
|
9
|
+
namedTemporaryFile,
|
|
10
|
+
temporaryDirectory
|
|
11
|
+
} from "./chunk-UGZ5OY5Z.js";
|
|
12
|
+
import "./chunk-MLKGABMK.js";
|
|
13
|
+
export {
|
|
14
|
+
NamedTemporaryFile,
|
|
15
|
+
TemporaryDirectory,
|
|
16
|
+
gettempdir,
|
|
17
|
+
gettempprefix,
|
|
18
|
+
mkdtemp,
|
|
19
|
+
mkstemp,
|
|
20
|
+
mktemp,
|
|
21
|
+
namedTemporaryFile,
|
|
22
|
+
temporaryDirectory
|
|
23
|
+
};
|