-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgcab-1.0.d.ts
More file actions
590 lines (491 loc) · 18.6 KB
/
gcab-1.0.d.ts
File metadata and controls
590 lines (491 loc) · 18.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GCab?version=1.0' {
// Module dependencies
import type Gio from 'gi://Gio?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
export namespace GCab {
/**
* GCab-1.0
*/
/**
* @gir-type Enum
*/
export namespace Compression {
export const $gtype: GObject.GType<Compression>;
}
/**
* Compression used by the {@link GCab.Folder}.
* @gir-type Enum
*/
enum Compression {
/**
* No compression.
*/
NONE,
/**
* MSZIP compression.
*/
MSZIP,
/**
* QUANTUM compression (unsupported).
*/
QUANTUM,
/**
* LZX compression (only decompression supported).
*/
LZX,
/**
* compression value mask.
*/
MASK,
}
/**
* The various errors triggered by the GCab functions.
* @gir-type Struct
*/
class Error extends GLib.Error {
static $gtype: GObject.GType<GLib.Error>;
// Static fields
/**
* The given file is not of Cabinet format.
*/
static FORMAT: number;
/**
* General function failure.
*/
static FAILED: number;
/**
* Action or format is not supported
*/
static NOT_SUPPORTED: number;
/**
* Data stream was invalid
*/
static INVALID_DATA: number;
// Constructors
constructor(options: { message: string, code: number });
}
/**
* @gir-type Enum
*/
export namespace FileAttribute {
export const $gtype: GObject.GType<FileAttribute>;
}
/**
* Attributes associated with the {@link GCab.File}.
* @gir-type Enum
*/
enum FileAttribute {
/**
* file is read-only
*/
RDONLY,
/**
* file is hidden
*/
HIDDEN,
/**
* file is a system file
*/
SYSTEM,
/**
* file modified since last backup
*/
ARCH,
/**
* run after extraction
*/
EXEC,
/**
* name contains UTF
*/
NAME_IS_UTF,
}
function error_quark(): GLib.Quark;
/**
* @gir-type Callback
*/
interface FileCallback {
(file: File): boolean;
}
namespace Cabinet {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
"notify::reserved": (pspec: GObject.ParamSpec) => void;
"notify::signature": (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
reserved: (Uint8Array | string);
signature: (Uint8Array | string);
}
}
/**
* An opaque object holding a Cabinet file reference.
* @gir-type Class
*/
class Cabinet extends GObject.Object {
static $gtype: GObject.GType<Cabinet>;
// Properties
get reserved(): Uint8Array;
set reserved(val: (Uint8Array | string));
get signature(): Uint8Array;
set signature(val: (Uint8Array | string));
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Cabinet.SignalSignatures;
// Constructors
constructor(properties?: Partial<Cabinet.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ["new"](): Cabinet;
// Signals
/** @signal */
connect<K extends keyof Cabinet.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, Cabinet.SignalSignatures[K]>): number;
connect(signal: string, callback: (...args: any[]) => any): number;
/** @signal */
connect_after<K extends keyof Cabinet.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, Cabinet.SignalSignatures[K]>): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
/** @signal */
emit<K extends keyof Cabinet.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<Cabinet.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Adds a compression kind to the allow-list. By default, GCab will use all decompression support
* compiled in at build time. Once this function has been called only specific compression kinds
* will be used in functions like `gcab_cabinet_load()`.
* @param compression a {@link GCab.Compression} kind, e.g. {@link GCab.Compression.MSZIP}
*/
add_allowed_compression(compression: Compression): void;
/**
* Add `folder` to `cabinet`.
* @param folder a {@link GCab.Folder}
* @returns `true` on success.
*/
add_folder(folder: Folder): boolean;
/**
* Extract files to given path.
*
* If `path` is NULL then the files are decompressed to memory blobs stored on
* each {@link GCab.File}.
* @param path the path to extract files
* @param file_callback an optional {@link GCab.File} callback, return `false` to filter out or skip files.
* @param progress_callback a progress callback
* @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore
* @returns `true` on success.
*/
extract(path: (Gio.File | null), file_callback: (FileCallback | null), progress_callback: (Gio.FileProgressCallback | null), cancellable: (Gio.Cancellable | null)): boolean;
/**
* Extract files to given path.
* @param path the path to extract files
* @param file_callback an optional {@link GCab.File} callback, return `false` to filter out or skip files.
* @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore
* @returns `true` on success.
*/
extract_simple(path: Gio.File, file_callback: (FileCallback | null), cancellable: (Gio.Cancellable | null)): boolean;
/**
* Get the Cabinet folders within the `cabinet`.
* Note that Cabinet folders are not like filesystem path, they are
* group of files sharing some layout parameters.
* @returns an array of {@link GCab.Folder}
*/
get_folders(): Folder[];
/**
* Lookup the cabinet authenticode signature if any.
* @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore
* @returns the array containing the PKCS#7 signed data or `null` on error.
*/
get_signature(cancellable: (Gio.Cancellable | null)): Uint8Array;
/**
* Get the size of the compressed cabinet file.
* @returns size in bytes
*/
get_size(): number;
/**
* Load a cabinet archive.
* @param stream a {@link Gio.InputStream}
* @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore
* @returns `true` on success
*/
load(stream: Gio.InputStream, cancellable: (Gio.Cancellable | null)): boolean;
/**
* Save `cabinet` to the output stream `out`. `out` must be a {@link Gio.Seekable}.
* @param stream a {@link Gio.OutputStream} also {@link Gio.Seekable}
* @param file_callback report current file being saved
* @param progress_callback report saving progress
* @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore
* @returns `true` on success.
*/
write(stream: Gio.OutputStream, file_callback: (FileCallback | null), progress_callback: (Gio.FileProgressCallback | null), cancellable: (Gio.Cancellable | null)): boolean;
/**
* Save `cabinet` to the output stream `out`. `out` must be a {@link Gio.Seekable}.
* @param stream a {@link Gio.OutputStream} also {@link Gio.Seekable}
* @param file_callback report current file being saved
* @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore
* @returns `true` on success.
*/
write_simple(stream: Gio.OutputStream, file_callback: (FileCallback | null), cancellable: (Gio.Cancellable | null)): boolean;
}
namespace File {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
"notify::bytes": (pspec: GObject.ParamSpec) => void;
"notify::file": (pspec: GObject.ParamSpec) => void;
"notify::name": (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
bytes: (GLib.Bytes | Uint8Array);
file: Gio.File;
name: string;
}
}
/**
* An opaque object, referencing a file in a Cabinet.
* @gir-type Class
*/
class File extends GObject.Object {
static $gtype: GObject.GType<File>;
// Properties
get bytes(): GLib.Bytes;
set bytes(val: (GLib.Bytes | Uint8Array));
get file(): Gio.File;
set file(val: Gio.File);
/**
* @default null
*/
get name(): string;
set name(val: string);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: File.SignalSignatures;
// Constructors
constructor(properties?: Partial<File.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static new_with_bytes(name: string, bytes: (GLib.Bytes | Uint8Array)): File;
static new_with_file(name: string, file: Gio.File): File;
// Signals
/** @signal */
connect<K extends keyof File.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, File.SignalSignatures[K]>): number;
connect(signal: string, callback: (...args: any[]) => any): number;
/** @signal */
connect_after<K extends keyof File.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, File.SignalSignatures[K]>): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
/** @signal */
emit<K extends keyof File.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<File.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Get the file attributes.
* @returns the cabinet file attributes
*/
get_attributes(): number;
/**
* Get the {@link Gio.File} associated with `file`. This will only be non-`null` if the
* {@link GCab.File} has been created using `gcab_file_new_with_bytes()`.
* @returns the associated {@link GLib.Bytes} or `null`
*/
get_bytes(): GLib.Bytes;
/**
* Get the file date, in `result`.
* @param result a {@link GLib.TimeVal} to return date
* @returns `true` if `tv` was set
*/
get_date(result: GLib.TimeVal): boolean;
/**
* Gets the file date and returns it as a {@link GLib.DateTime}..
* @returns file date, or NULL if unknown.
*/
get_date_time(): GLib.DateTime;
/**
* Get the file name to use for extraction, or `null`.
* @returns a file name
*/
get_extract_name(): (string | null);
/**
* If the cabinet is being created, get the {@link Gio.File} associated with
* `file`. This must be an exisiting file that can be read, in order to
* be added to the archive during cabinet creation.
*
* If `file` is from an existing cabinet, the fuction will return
* `null`.
* @returns the associated {@link Gio.File} or `null`
*/
get_file(): Gio.File;
/**
* Get the file name within the cabinet.
* @returns the cabinet file name
*/
get_name(): string;
/**
* Get the file size.
* @returns the cabinet file size
*/
get_size(): number;
/**
* Set the file attributes.
* @param attr the attributes, e.g. {@link GCab.FileAttribute.RDONLY}
*/
set_attributes(attr: number): void;
/**
* Replace the {@link GLib.Bytes} associated with `self`.
* This is most usefule when the {@link GCab.File} has been created using
* `gcab_file_new_with_bytes()` and the data needs to be modified.
* @param bytes a {@link GLib.Bytes}
*/
set_bytes(bytes: (GLib.Bytes | Uint8Array)): void;
/**
* Sets the file modification date, instead of the value provided by the GFile.
* @param tv a {@link GLib.TimeVal}
*/
set_date(tv: GLib.TimeVal): void;
/**
* Sets the file modification date (instead of the date provided by the GFile)
* @param dt a {@link GLib.DateTime}
*/
set_date_time(dt: GLib.DateTime): void;
/**
* Sets the file name to use for extraction, instead of the name
* provided by the Cabinet.
* @param name a file name or `null`
*/
set_extract_name(name: (string | null)): void;
}
namespace Folder {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
"notify::compression": (pspec: GObject.ParamSpec) => void;
"notify::comptype": (pspec: GObject.ParamSpec) => void;
"notify::reserved": (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
compression: Compression;
comptype: number;
reserved: (Uint8Array | string);
}
}
/**
* An opaque object, referencing a folder in a Cabinet.
* @gir-type Class
*/
class Folder extends GObject.Object {
static $gtype: GObject.GType<Folder>;
// Properties
/**
* @read-only
* @default GCab.Compression.NONE
*/
get compression(): Compression;
/**
* @construct-only
* @default 0
*/
get comptype(): number;
get reserved(): Uint8Array;
set reserved(val: (Uint8Array | string));
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Folder.SignalSignatures;
// Constructors
constructor(properties?: Partial<Folder.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ["new"](comptype: number): Folder;
// Signals
/** @signal */
connect<K extends keyof Folder.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, Folder.SignalSignatures[K]>): number;
connect(signal: string, callback: (...args: any[]) => any): number;
/** @signal */
connect_after<K extends keyof Folder.SignalSignatures>(signal: K, callback: GObject.SignalCallback<this, Folder.SignalSignatures[K]>): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
/** @signal */
emit<K extends keyof Folder.SignalSignatures>(signal: K, ...args: GObject.GjsParameters<Folder.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Add `file` to the {@link GCab.Folder}.
* @param cabfile file to be added
* @param recurse whether to recurse through subdirectories
* @param cancellable optional {@link Gio.Cancellable} object, `null` to ignore
* @returns `true` on succes
*/
add_file(cabfile: File, recurse: boolean, cancellable: (Gio.Cancellable | null)): boolean;
/**
* Returns the compression used in this folder.
* @returns a {@link GCab.Compression}, e.g. {@link GCab.Compression.MSZIP}
*/
get_comptype(): number;
/**
* Gets a specific {@link GCab.File} files contained in the `cabfolder`.
* @param name a file name
* @returns A {@link GCab.File}, or `null` if not found
*/
get_file_by_name(name: string): File;
/**
* Get the list of {@link GCab.File} files contained in the `cabfolder`.
* @returns list of files
*/
get_files(): File[];
/**
* Get the number of files in this `folder`.
* @returns a `guint`
*/
get_nfiles(): number;
}
/**
* @gir-type Alias
*/
type CabinetClass = typeof Cabinet;
/**
* @gir-type Alias
*/
type FileClass = typeof File;
/**
* @gir-type Alias
*/
type FolderClass = typeof Folder;
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default GCab;
}
declare module 'gi://GCab' {
import GCab10 from 'gi://GCab?version=1.0';
export default GCab10;
}
// END