Repository navigation
Expand file tree
/
Copy pathgenerated.d.ts
More file actions
1432 lines (1405 loc) · 42.7 KB
/
Copy pathgenerated.d.ts
File metadata and controls
1432 lines (1405 loc) · 42.7 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
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* auto-generated by NAPI-RS */
/* eslint-disable */
export declare class ExternalObject<T> {
readonly '': {
readonly '': unique symbol
[K: symbol]: T
}
}
/**
* BlockingLister is designed to list entries at a given path in a blocking
* manner.
*/
export declare class BlockingLister {
next(): Entry | null
}
/**
* BlockingReader is designed to read data from a given path in a blocking
* manner.
*/
export declare class BlockingReader {
read(buf: Buffer): bigint
}
/**
* BlockingWriter is designed to write data into a given path in a blocking
* manner.
*/
export declare class BlockingWriter {
/**
* # Safety
*
* > &mut self in async napi methods should be marked as unsafe
*
* Write bytes into this writer.
*
* ### Example
* ```javascript
* const writer = await op.writer("path/to/file");
* await writer.write(Buffer.from("hello world"));
* await writer.close();
* ```
*/
write(content: Buffer | string): void
/**
* # Safety
*
* > &mut self in async napi methods should be marked as unsafe
*
* Close this writer.
*
* ### Example
*
* ```javascript
* const writer = op.writerSync("path/to/file");
* writer.write(Buffer.from("hello world"));
* writer.close();
* ```
*/
close(): void
}
/**
* Capability is used to describe what operations are supported
* by the current Operator.
*
* Via capability, we can know:
*
* - Whether current Operator supports `read` or not.
* - Whether current Operator supports `read` with if match or not.
* - What's current Operator max supports batch operations count.
*
* Add fields of Capabilities to be public and can be accessed directly.
*/
export declare class Capability {
/** If operator supports stat. */
get stat(): boolean
/** If operator supports stat with if matched. */
get statWithIfMatch(): boolean
/** If operator supports stat with if not match. */
get statWithIfNoneMatch(): boolean
/** If operator supports stat with if modified since. */
get statWithIfModifiedSince(): boolean
/** If operator supports stat with if unmodified since. */
get statWithIfUnmodifiedSince(): boolean
/** If operator supports stat with versions. */
get statWithVersion(): boolean
/** If operator supports stat with override content type. */
get statWithOverrideContentType(): boolean
/** If operator supports stat with override cache control. */
get statWithOverrideCacheControl(): boolean
/** If operator supports stat with override content disposition. */
get statWithOverrideContentDisposition(): boolean
/** If operator supports read. */
get read(): boolean
/** If operator supports read with version. */
get readWithVersion(): boolean
/** If operator supports read with range. */
get readWithIfModifiedSince(): boolean
/** If operator supports read with if unmodified since. */
get readWithIfUnmodifiedSince(): boolean
/** If operator supports read with if matched. */
get readWithIfMatch(): boolean
/** If operator supports read with if not match. */
get readWithIfNoneMatch(): boolean
/** if operator supports read with override cache control. */
get readWithOverrideCacheControl(): boolean
/** if operator supports `read` with override content disposition. */
get readWithOverrideContentDisposition(): boolean
/** if operator supports read with override content type. */
get readWithOverrideContentType(): boolean
/** If operator supports write. */
get write(): boolean
/** If operator supports write can be called in multi times. */
get writeCanMulti(): boolean
/** If operator supports write with empty content. */
get writeCanEmpty(): boolean
/** If operator supports write by append. */
get writeCanAppend(): boolean
/** If operator supports write with content type. */
get writeWithContentType(): boolean
/** If operator supports write with content disposition. */
get writeWithContentDisposition(): boolean
/** If operator supports write with cache control. */
get writeWithCacheControl(): boolean
/** If operator supports write with content encoding. */
get writeWithContentEncoding(): boolean
/** If operator supports write with user metadata. */
get writeWithUserMetadata(): boolean
/** If operator supports write with if match. */
get writeWithIfMatch(): boolean
/** If operator supports write with if none match. */
get writeWithIfNoneMatch(): boolean
/** If operator supports write with if not exists. */
get writeWithIfNotExists(): boolean
/**
* write_multi_max_size is the max size that services support in write_multi.
*
* For example, AWS S3 supports 5GiB as max in write_multi.
*/
get writeMultiMaxSize(): bigint | null
/**
* write_multi_min_size is the min size that services support in write_multi.
*
* For example, AWS S3 requires at least 5MiB in write_multi expect the last one.
*/
get writeMultiMinSize(): bigint | null
/**
* write_total_max_size is the max size that services support in write_total.
*
* For example, Cloudflare D1 supports 1MB as max in write_total.
*/
get writeTotalMaxSize(): bigint | null
/** If operator supports create dir. */
get createDir(): boolean
/** If operator supports delete. */
get delete(): boolean
/** If operator supports delete by version. */
get deleteWithVersion(): boolean
/** If operator supports copy. */
get copy(): boolean
/** If operator supports rename. */
get rename(): boolean
/** If operator supports list. */
get list(): boolean
/** If backend supports list with limit. */
get listWithLimit(): boolean
/** If backend supports list with start after. */
get listWithStartAfter(): boolean
/** If backend supports list with recursive. */
get listWithRecursive(): boolean
/** If backend supports list with versions. */
get listWithVersions(): boolean
/** If backend supports list with deleted. */
get listWithDeleted(): boolean
/** If operator supports presign. */
get presign(): boolean
/** If operator supports presign read. */
get presignRead(): boolean
/** If operator supports presign stat. */
get presignStat(): boolean
/** If operator supports presign write. */
get presignWrite(): boolean
/** If operator supports presign delete. */
get presignDelete(): boolean
/** If operator supports shared. */
get shared(): boolean
}
/**
* Capability override layer
*
* Override the full capability exposed by an operator.
*/
export declare class CapabilityOverrideLayer {
/** Create a new CapabilityOverrideLayer from capability override entries. */
constructor(overrides: string)
build(): ExternalObject<Layer>
}
/**
* Concurrent limit layer
*
* Add concurrent request limit.
*
* # Notes
*
* Users can control how many concurrent connections could be established
* between OpenDAL and underlying storage services.
*
* All operators wrapped by this layer will share a common semaphore.
*
* # Examples
*
* ```javascript
* const op = new Operator("fs", { root: "/tmp" })
*
* // Create a concurrent limit layer with 1024 permits
* const limit = new ConcurrentLimitLayer(1024);
* op.layer(limit.build());
* ```
*
* With HTTP concurrent limit:
*
* ```javascript
* const limit = new ConcurrentLimitLayer(1024);
* limit.httpPermits = 512;
* op.layer(limit.build());
* ```
*/
export declare class ConcurrentLimitLayer {
/**
* Create a new ConcurrentLimitLayer with specified permits.
*
* This permits will be applied to all operations.
*
* # Arguments
*
* * `permits` - The maximum number of concurrent operations allowed.
*/
constructor(permits: number)
/**
* Set a concurrent limit for HTTP requests.
*
* This will limit the number of concurrent HTTP requests made by the operator.
*
* # Arguments
*
* * `v` - The maximum number of concurrent HTTP requests allowed.
*/
set httpPermits(v: number)
/**
* Build the layer.
*
* Returns an `External<Layer>` that can be used with `Operator.layer()`.
*/
build(): ExternalObject<Layer>
}
/** Entry returned by Lister or BlockingLister to represent a path, and it's a relative metadata. */
export declare class Entry {
/** Return the path of this entry. */
path(): string
/** Return the name of this entry. */
name(): string
/** Return the metadata of this entry. */
metadata(): Metadata
}
/** A public layer wrapper */
export declare class Layer {
}
/**
* Lister is designed to list entries at a given path in an asynchronous
* manner.
*/
export declare class Lister {
/**
* # Safety
*
* > &mut self in async napi methods should be marked as unsafe
*
* napi will make sure the function is safe, and we didn't do unsafe
* things internally.
*/
next(): Promise<Entry | null>
}
/**
* Logging layer
*
* Add log for every operation.
*
* # Logging
*
* - OpenDAL will log in structural way.
* - Every operation will start with a `started` log entry.
* - Every operation will finish with the following status:
* - `succeeded`: the operation is successful, but might have more to take.
* - `finished`: the whole operation is finished.
* - `failed`: the operation returns an unexpected error.
* - The default log level while expected error happened is `Warn`.
* - The default log level while unexpected failure happened is `Error`.
*
* # Examples
*
* ```javascript
* const op = new Operator("fs", { root: "/tmp" })
*
* const logging = new LoggingLayer();
* op.layer(logging.build());
* ```
*
* # Output
*
* To enable logging output, set the `RUST_LOG` environment variable:
*
* ```shell
* RUST_LOG=debug node app.js
* ```
*/
export declare class LoggingLayer {
constructor()
build(): ExternalObject<Layer>
}
/** Metadata carries all metadata associated with a path. */
export declare class Metadata {
/** Returns true if the <op.stat> object describes a file system directory. */
isDirectory(): boolean
/** Returns true if the <op.stat> object describes a regular file. */
isFile(): boolean
/**
* This function returns `true` if the file represented by this metadata has been marked for
* deletion or has been permanently deleted.
*/
isDeleted(): boolean
/** Cache-Control of this object. */
get cacheControl(): string | null
/** Content-Disposition of this object */
get contentDisposition(): string | null
/** Content Length of this object */
get contentLength(): bigint | null
/** Content Encoding of this object */
get contentEncoding(): string | null
/** Content MD5 of this object. */
get contentMd5(): string | null
/** Content Type of this object. */
get contentType(): string | null
/** User Metadata of this object. */
get userMetadata(): Record<string, string> | null
/** ETag of this object. */
get etag(): string | null
/**
* Last Modified of this object.
*
* We will output this time in RFC3339 format like `1996-12-19T16:39:57+08:00`.
*/
get lastModified(): string | null
/** mode represent this entry's mode. */
get mode(): EntryMode | null
/** Retrieves the `version` of the file, if available. */
get version(): string | null
}
export declare class Operator {
/**
* @see For the full list of scheme, see https://docs.rs/opendal/latest/opendal/services/index.html
* And the options,
* please refer to the documentation of the corresponding service for the corresponding parameters.
* Note that the current options key is snake_case.
*/
constructor(scheme: string, options?: Record<string, string> | undefined | null)
/**
* Create a new operator from a URI string.
*
* The URI encodes the scheme and configuration in a single string, e.g.
* `memory://localhost/` or `s3://bucket/path?region=us-east-1`.
*
* Optional extra key-value options can be passed to override or supplement
* the values encoded in the URI.
*
* ### Example
*
* ```javascript
* const op = Operator.fromUri("memory://localhost/");
* const op2 = Operator.fromUri("s3://my-bucket/", { region: "us-east-1" });
* ```
*/
static fromUri(uri: string, options?: Record<string, string> | undefined | null): Operator
/** Get current operator(service)'s full capability. */
capability(): Capability
/**
* Get current path's metadata **without cache** directly.
*
* ### Notes
* Use stat if you:
*
* - Want to detect the outside changes of a path.
* - Don’t want to read from cached metadata.
*
* You may want to use `metadata` if you are working with entries returned by `Lister`. It’s highly possible that metadata you want has already been cached.
*
* ### Example
* ```javascript
* const meta = await op.stat("test");
* if (meta.isDir) {
* // do something
* }
* ```
*/
stat(path: string, options?: StatOptions | undefined | null): Promise<Metadata>
/**
* Get current path's metadata **without cache** directly and synchronously.
*
* ### Example
* ```javascript
* const meta = op.statSync("test");
* if (meta.isDir) {
* // do something
* }
* ```
*/
statSync(path: string, options?: StatOptions | undefined | null): Metadata
/**
* Check if this operator can work correctly.
*
* We will send a `list` request to the given path and return any errors we met.
*
* ### Example
* ```javascript
* await op.check();
* ```
*/
check(): Promise<void>
/**
* Check the op synchronously.
*
* ### Example
* ```javascript
* op.checkSync();
* ```
*/
checkSync(): void
/**
* Check if this path exists or not.
*
* ### Example
* ```javascript
* await op.isExist("test");
* ```
*/
exists(path: string): Promise<boolean>
/**
* Check if this path exists or not synchronously.
*
* ### Example
* ```javascript
* op.isExistSync("test");
* ```
*/
existsSync(path: string): boolean
/**
* Create dir with a given path.
*
* ### Example
* ```javascript
* await op.createDir("path/to/dir/");
* ```
*/
createDir(path: string): Promise<void>
/**
* Create dir with a given path synchronously.
*
* ### Example
* ```javascript
* op.createDirSync("path/to/dir/");
* ```
*/
createDirSync(path: string): void
/**
* Read the whole path into a buffer.
*
* ### Example
* ```javascript
* const buf = await op.read("path/to/file");
* ```
*/
read(path: string, options?: ReadOptions | undefined | null): Promise<Buffer>
/**
* Create a reader to read the given path.
*
* It could be used to read large file in a streaming way.
*/
reader(path: string, options?: ReaderOptions | undefined | null): Promise<Reader>
/**
* Read the whole path into a buffer synchronously.
*
* ### Example
* ```javascript
* const buf = op.readSync("path/to/file");
* ```
*/
readSync(path: string, options?: ReadOptions | undefined | null): Buffer
/**
* Create a reader to read the given path synchronously.
*
* It could be used to read large file in a streaming way.
*/
readerSync(path: string, options?: ReaderOptions | undefined | null): BlockingReader
/**
* Write bytes into a path.
*
* ### Example
* ```javascript
* await op.write("path/to/file", Buffer.from("hello world"));
* // or
* await op.write("path/to/file", "hello world");
* // or
* await op.write("path/to/file", Buffer.from("hello world"), { contentType: "text/plain" });
* ```
*/
write(path: string, content: Buffer | string, options?: WriteOptions | undefined | null): Promise<Metadata>
/**
* Write multiple bytes into a path.
*
* It could be used to write large file in a streaming way.
*/
writer(path: string, options?: WriteOptions | undefined | null): Promise<Writer>
/**
* Write multiple bytes into a path synchronously.
*
* It could be used to write large file in a streaming way.
*/
writerSync(path: string, options?: WriteOptions | undefined | null): BlockingWriter
/**
* Write bytes into a path synchronously.
*
* ### Example
* ```javascript
* op.writeSync("path/to/file", Buffer.from("hello world"));
* // or
* op.writeSync("path/to/file", "hello world");
* // or
* op.writeSync("path/to/file", Buffer.from("hello world"), { contentType: "text/plain" });
* ```
*/
writeSync(path: string, content: Buffer | string, options?: WriteOptions | undefined | null): Metadata
/**
* Copy file according to given `from` and `to` path.
*
* ### Example
* ```javascript
* await op.copy("path/to/file", "path/to/dest");
* ```
*/
copy(from: string, to: string): Promise<void>
/**
* Copy file according to given `from` and `to` path synchronously.
*
* ### Example
* ```javascript
* op.copySync("path/to/file", "path/to/dest");
* ```
*/
copySync(from: string, to: string): void
/**
* Rename file according to given `from` and `to` path.
*
* It's similar to `mv` command.
*
* ### Example
* ```javascript
* await op.rename("path/to/file", "path/to/dest");
* ```
*/
rename(from: string, to: string): Promise<void>
/**
* Rename file according to given `from` and `to` path synchronously.
*
* It's similar to `mv` command.
*
* ### Example
* ```javascript
* op.renameSync("path/to/file", "path/to/dest");
* ```
*/
renameSync(from: string, to: string): void
/**
* Delete the given path.
*
* ### Notes
* Delete not existing error won’t return errors.
*
* ### Example
* ```javascript
* await op.delete("test");
* ```
*/
delete(path: string, options?: DeleteOptions | undefined | null): Promise<void>
/**
* Delete the given path synchronously.
*
* ### Example
* ```javascript
* op.deleteSync("test");
* ```
*/
deleteSync(path: string, options?: DeleteOptions | undefined | null): void
/**
* Remove given paths.
*
* ### Notes
* If underlying services support delete in batch, we will use batch delete instead.
*
* ### Examples
* ```javascript
* await op.remove(["abc", "def"]);
* ```
*/
remove(paths: Array<string>): Promise<void>
/**
* Remove given paths.
*
* ### Notes
* If underlying services support delete in batch, we will use batch delete instead.
*
* ### Examples
* ```javascript
* op.removeSync(["abc", "def"]);
* ```
*/
removeSync(paths: Array<string>): void
/**
* Remove the path and all nested dirs and files recursively.
*
* ### Notes
* If underlying services support delete in batch, we will use batch delete instead.
*
* ### Examples
* ```javascript
* await op.removeAll("path/to/dir/");
* ```
*/
removeAll(path: string): Promise<void>
/**
* Remove the path and all nested dirs and files recursively.
*
* ### Notes
* If underlying services support delete in batch, we will use batch delete instead.
*
* ### Examples
* ```javascript
* op.removeAllSync("path/to/dir/");
* ```
*/
removeAllSync(path: string): void
/**
* List the given path.
*
* This function will return an array of entries.
*
* An error will be returned if given path doesn't end with `/`.
*
* ### Example
*
* ```javascript
* const list = await op.list("path/to/dir/");
* for (let entry of list) {
* let meta = await op.stat(entry.path);
* if (meta.isFile) {
* // do something
* }
* }
* ```
*
* #### List recursively
*
* With `recursive` option, you can list recursively.
*
* ```javascript
* const list = await op.list("path/to/dir/", { recursive: true });
* for (let entry of list) {
* let meta = await op.stat(entry.path);
* if (meta.isFile) {
* // do something
* }
* }
* ```
*/
list(path: string, options?: ListOptions | undefined | null): Promise<Array<Entry>>
/**
* List the given path synchronously.
*
* This function will return an array of entries.
*
* An error will be returned if given path doesn't end with `/`.
*
* ### Example
*
* ```javascript
* const list = op.listSync("path/to/dir/");
* for (let entry of list) {
* let meta = op.statSync(entry.path);
* if (meta.isFile) {
* // do something
* }
* }
* ```
*
* #### List recursively
*
* With `recursive` option, you can list recursively.
*
* ```javascript
* const list = op.listSync("path/to/dir/", { recursive: true });
* for (let entry of list) {
* let path = entry.path();
* let meta = entry.metadata();
* if (meta.isFile) {
* // do something
* }
* }
* ```
*/
listSync(path: string, options?: ListOptions | undefined | null): Array<Entry>
/**
* Create a lister to list entries at given path.
*
* This function returns a Lister that can be used to iterate over entries
* in a streaming manner, which is more memory-efficient for large directories.
*
* An error will be returned if given path doesn't end with `/`.
*
* ### Example
*
* ```javascript
* const lister = await op.lister("path/to/dir/");
* let entry;
* while ((entry = await lister.next()) !== null) {
* console.log(entry.path());
* }
* ```
*
* #### List recursively
*
* With `recursive` option, you can list recursively.
*
* ```javascript
* const lister = await op.lister("path/to/dir/", { recursive: true });
* let entry;
* while ((entry = await lister.next()) !== null) {
* console.log(entry.path());
* }
* ```
*/
lister(path: string, options?: ListOptions | undefined | null): Promise<Lister>
/**
* Create a lister to list entries at given path synchronously.
*
* This function returns a BlockingLister that can be used to iterate over entries
* in a streaming manner, which is more memory-efficient for large directories.
*
* An error will be returned if given path doesn't end with `/`.
*
* ### Example
*
* ```javascript
* const lister = op.listerSync("path/to/dir/");
* let entry;
* while ((entry = lister.next()) !== null) {
* console.log(entry.path());
* }
* ```
*
* #### List recursively
*
* With `recursive` option, you can list recursively.
*
* ```javascript
* const lister = op.listerSync("path/to/dir/", { recursive: true });
* let entry;
* while ((entry = lister.next()) !== null) {
* console.log(entry.path());
* }
* ```
*/
listerSync(path: string, options?: ListOptions | undefined | null): BlockingLister
/**
* Get a presigned request for read.
*
* Unit of `expires` is seconds.
*
* ### Example
*
* ```javascript
* const req = await op.presignRead(path, parseInt(expires));
*
* console.log("method: ", req.method);
* console.log("url: ", req.url);
* console.log("headers: ", req.headers);
* ```
*/
presignRead(path: string, expires: number): Promise<PresignedRequest>
/**
* Get a presigned request for `write`.
*
* Unit of `expires` is seconds.
*
* ### Example
*
* ```javascript
* const req = await op.presignWrite(path, parseInt(expires));
*
* console.log("method: ", req.method);
* console.log("url: ", req.url);
* console.log("headers: ", req.headers);
* ```
*/
presignWrite(path: string, expires: number): Promise<PresignedRequest>
/**
* Get a presigned request for stat.
*
* Unit of `expires` is seconds.
*
* ### Example
*
* ```javascript
* const req = await op.presignStat(path, parseInt(expires));
*
* console.log("method: ", req.method);
* console.log("url: ", req.url);
* console.log("headers: ", req.headers);
* ```
*/
presignStat(path: string, expires: number): Promise<PresignedRequest>
/**
* Get a presigned request for delete.
*
* Unit of `expires` is seconds.
*
* ### Example
*
* ```javascript
* const req = await op.presignDelete(path, parseInt(expires));
*
* console.log("method: ", req.method);
* console.log("url: ", req.url);
* console.log("headers: ", req.headers);
* ```
*/
presignDelete(path: string, expires: number): Promise<PresignedRequest>
/** Add a layer to this operator. */
layer(layer: ExternalObject<Layer>): Operator
}
/**
* Reader is designed to read data from a given path in an asynchronous
* manner.
*/
export declare class Reader {
/**
* # Safety
*
* > &mut self in async napi methods should be marked as unsafe
*
* Read bytes from this reader into given buffer.
*/
read(buf: Buffer): Promise<bigint>
}
/**
* Retry layer
*
* Add retry for temporary failed operations.
*
* # Notes
*
* This layer will retry failed operations when [`Error::is_temporary`]
* returns true.
* If the operation still failed, this layer will set error to
* `Persistent` which means error has been retried.
*
* `write` and `blocking_write` don't support retry so far,
* visit [this issue](https://github.com/apache/opendal/issues/1223) for more details.
*
* # Examples
*
* ```javascript
* const op = new Operator("fs", { root: "/tmp" })
*
* const retry = new RetryLayer();
* retry.max_times = 3;
* retry.jitter = true;
*
* op.layer(retry.build());
* ```
*/
export declare class RetryLayer {
constructor()
/**
* Set jitter of current backoff.
*
* If jitter is enabled, ExponentialBackoff will add a random jitter in `[0, min_delay)`
* to current delay.
*/
set jitter(v: boolean)
/**
* Set max_times of current backoff.
*
* Backoff will return `None` if max times are reached.
*/
set maxTimes(v: number)
/**
* Set factor of current backoff.
*
* # Panics
*
* This function will panic if the input factor is smaller than `1.0`.
*/
set factor(v: number)
/**
* Set max_delay of current backoff.
*
* Delay will not increase if the current delay is larger than max_delay.
*
* # Notes
*
* - The unit of max_delay is millisecond.
*/
set maxDelay(v: number)
/**
* Set min_delay of current backoff.
*
* # Notes
*
* - The unit of min_delay is millisecond.
*/
set minDelay(v: number)
build(): ExternalObject<Layer>
}
/**
* Throttle layer
*
* Add a bandwidth rate limiter to the underlying services.
*
* # Throttle
*
* There are several algorithms when it come to rate limiting techniques.
* This throttle layer uses Generic Cell Rate Algorithm (GCRA) provided by Governor.
* By setting the `bandwidth` and `burst`, we can control the byte flow rate of underlying services.
*
* # Note
*
* When setting the ThrottleLayer, always consider the largest possible operation size as the burst size,
* as **the burst size should be larger than any possible byte length to allow it to pass through**.
*
* # Examples
*
* This example limits bandwidth to 10 KiB/s and burst size to 10 MiB.
*
* ```javascript
* const op = new Operator("fs", { root: "/tmp" })
*
* const throttle = new ThrottleLayer(10 * 1024, 10000 * 1024);
* op.layer(throttle.build());
* ```
*/
export declare class ThrottleLayer {
/**
* Create a new `ThrottleLayer` with given bandwidth and burst.
*
* # Arguments
*
* - `bandwidth`: the maximum number of bytes allowed to pass through per second.
* - `burst`: the maximum number of bytes allowed to pass through at once.
*