-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapi.md
1368 lines (934 loc) · 43.1 KB
/
api.md
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
# Summary
Members | Descriptions
--------------------------------|---------------------------------------------
`class ` [`Arduino_UnifiedStorage`](#class_arduino___unified_storage) | Abstract class representing the common features of the supported storage methods
`class ` [`Folder`](#class_folder) | Class representing a directory.
`class ` [`InternalStorage`](#class_internal_storage) | Represents internal storage using the Arduino Unified Storage library.
`class ` [`Partitioning`](#class_partitioning) |
`class ` [`SDStorage`](#class_s_d_storage) | Represents an SD card storage using the Arduino Unified Storage library.
`class ` [`UFile`](#class_u_file) | Class representing a File
`class ` [`USBStorage`](#class_u_s_b_storage) | [USBStorage](#class_u_s_b_storage) class provides an interface to access USB storage devices. It inherits from the [Arduino_UnifiedStorage](#class_arduino___unified_storage) class and implements its pure virtual functions.
`struct ` [`Partition`](#struct_partition) |
# class `Arduino_UnifiedStorage` <a id="class_arduino___unified_storage" class="anchor"></a>
Abstract class representing the common features of the supported storage methods
## Summary
Members | Descriptions
--------------------------------|---------------------------------------------
| [`begin`](#class_arduino___unified_storage_1a350443027c76ea18f2812a54aa8ab437) | Initializes the storage. |
| [`begin`](#class_arduino___unified_storage_1acb25f75f3dcdb89ebce3c7cd08970a99) | Initializes the storage with the specified file system. |
| [`unmount`](#class_arduino___unified_storage_1a4281bc190ee4f2ad35265eab64ef6f7f) | Unmounts the storage. |
| [`getRootFolder`](#class_arduino___unified_storage_1a7166075ba695d54bf74c6c71b8c4c1bf) | Retrieves the root folder of the storage. |
| [`format`](#class_arduino___unified_storage_1ad6d045b4bdafd4dcb75daed305888e25) | Formats the storage with the selected file system. |
| [`debugPrint`](#class_arduino___unified_storage_1a466b794918c895d105501507f9337e61) | |
| [`testPrint`](#class_arduino___unified_storage_1ab76317acb2bf69c6fdf7575ed317e8f2) | |
## Members
### `begin` <a id="class_arduino___unified_storage_1a350443027c76ea18f2812a54aa8ab437" class="anchor"></a>
```cpp
public bool begin()
```
Initializes the storage.
#### Returns
true if successful, false if failed.
<hr />
### `begin` <a id="class_arduino___unified_storage_1acb25f75f3dcdb89ebce3c7cd08970a99" class="anchor"></a>
```cpp
public bool begin(FileSystems fs)
```
Initializes the storage with the specified file system.
#### Parameters
* `fs` The desired file system (FS_FAT or FS_LITTLEFS).
#### Returns
true if successful, false if failed.
<hr />
### `unmount` <a id="class_arduino___unified_storage_1a4281bc190ee4f2ad35265eab64ef6f7f" class="anchor"></a>
```cpp
public bool unmount()
```
Unmounts the storage.
#### Returns
true if successful, false if failed.
<hr />
### `getRootFolder` <a id="class_arduino___unified_storage_1a7166075ba695d54bf74c6c71b8c4c1bf" class="anchor"></a>
```cpp
public Folder getRootFolder()
```
Retrieves the root folder of the storage.
#### Returns
The root folder as a [Folder](#class_folder) object.
<hr />
### `format` <a id="class_arduino___unified_storage_1ad6d045b4bdafd4dcb75daed305888e25" class="anchor"></a>
```cpp
public bool format(FileSystems fs)
```
Formats the storage with the selected file system.
#### Returns
true if successful, false if failed.
<hr />
### `debugPrint` <a id="class_arduino___unified_storage_1a466b794918c895d105501507f9337e61" class="anchor"></a>
```cpp
public static void debugPrint(String message)
```
<hr />
### `testPrint` <a id="class_arduino___unified_storage_1ab76317acb2bf69c6fdf7575ed317e8f2" class="anchor"></a>
```cpp
public static void testPrint(String message)
```
<hr />
# class `Folder` <a id="class_folder" class="anchor"></a>
Class representing a directory.
## Summary
Members | Descriptions
--------------------------------|---------------------------------------------
| [`Folder`](#class_folder_1a8af69fd19ba86816c60b4c2291311eb1) | Creates an empty [Folder](#class_folder) object. Please note that any operation on this object will fail until a valid directory is assigned to it. |
| [`Folder`](#class_folder_1aa2a4dc98e8c383c7b4fa503b45813fe3) | Creates a directory with the specified name. If the directory already exists, it returns a [Folder](#class_folder) object representing the existing directory. Otherwise, it tries to create a new directory with the specified name. If it fails the `path` property of the [Folder](#class_folder) object will be null. |
| [`Folder`](#class_folder_1a6f445bfe0214a03ba00a1408e41726dd) | Creates a directory with the specified name. If the directory already exists, it returns a [Folder](#class_folder) object representing the existing directory. Otherwise, it tries to create a new directory with the specified name. If it fails the `path` property of the [Folder](#class_folder) object will be empty. |
| [`createFile`](#class_folder_1a04eceb0406b02e2d8a628d3c359dba5d) | Creates a file inside the directory. |
| [`createFile`](#class_folder_1a44255e2c0c4ffa37d7637a601bc590f6) | Creates a file inside the directory. |
| [`remove`](#class_folder_1aca893daac6c6747895d50987cf9cf34c) | Removes a directory. |
| [`rename`](#class_folder_1adcbb7766d628810f716887d1e7e8d36f) | Renames a directory. |
| [`rename`](#class_folder_1a14519c2a344ebfb8161c2bee2a2b5464) | Renames a directory. |
| [`exists`](#class_folder_1aa548278d3ec09fd4abcaa827a79c40f4) | Checks if the directory exists. |
| [`getPath`](#class_folder_1a0ef68289c526f8bf24020389c4e09e86) | Returns the path of the file. |
| [`getPathAsString`](#class_folder_1ac816d0fe5674c4648e97423b6f9c51f8) | Returns the path of the file. |
| [`createSubfolder`](#class_folder_1a78f2f9b297f62b67c2e0656b15a95868) | Creates a subfolder in the directory. |
| [`createSubfolder`](#class_folder_1ab50743664becb7b2a1fb564b5513d69c) | Creates a subfolder in the directory. |
| [`getFiles`](#class_folder_1a2e7f604d19b8ad61524f86ade86ed4ad) | Returns File objects for all files in the current directory. |
| [`getFolders`](#class_folder_1a5554b8cc2fd1ca39dfccbd06bc635e10) | Returns [Folder](#class_folder) objects for all files in the current directory. |
| [`copyTo`](#class_folder_1aabf0818b7ee45b2d871e82e86edb4ebd) | Copies the current directory. |
| [`copyTo`](#class_folder_1a058d193f53c559eefe343b30797500eb) | Copies the current directory. |
| [`copyTo`](#class_folder_1a3162979e4c679c7f5503cc4584949714) | Copies the current directory. |
| [`moveTo`](#class_folder_1a5002b388b7e503ba79a8623ca6c1cbbd) | Moves the current directory. |
| [`moveTo`](#class_folder_1a0ab690abfff790a2bd9fff3dd5976e82) | Moves the current directory. |
| [`moveTo`](#class_folder_1a3125db272185165a03b891efe5985a32) | Move the current directory. |
## Members
### `Folder` <a id="class_folder_1a8af69fd19ba86816c60b4c2291311eb1" class="anchor"></a>
```cpp
public Folder()
```
Creates an empty [Folder](#class_folder) object. Please note that any operation on this object will fail until a valid directory is assigned to it.
<hr />
### `Folder` <a id="class_folder_1aa2a4dc98e8c383c7b4fa503b45813fe3" class="anchor"></a>
```cpp
public Folder(const char * dirname)
```
Creates a directory with the specified name. If the directory already exists, it returns a [Folder](#class_folder) object representing the existing directory. Otherwise, it tries to create a new directory with the specified name. If it fails the `path` property of the [Folder](#class_folder) object will be null.
#### Parameters
* `const` char * dirname - The name of the directory.
<hr />
### `Folder` <a id="class_folder_1a6f445bfe0214a03ba00a1408e41726dd" class="anchor"></a>
```cpp
public Folder(String dirname)
```
Creates a directory with the specified name. If the directory already exists, it returns a [Folder](#class_folder) object representing the existing directory. Otherwise, it tries to create a new directory with the specified name. If it fails the `path` property of the [Folder](#class_folder) object will be empty.
#### Parameters
* `String` dirname - The name of the directory.
<hr />
### `createFile` <a id="class_folder_1a04eceb0406b02e2d8a628d3c359dba5d" class="anchor"></a>
```cpp
public UFile createFile(const char * fileName, FileMode fmode)
```
Creates a file inside the directory.
#### Parameters
* `const` char * fileName - The name of the file to create.
#### Returns
A File object if successful, NULL if not.
<hr />
### `createFile` <a id="class_folder_1a44255e2c0c4ffa37d7637a601bc590f6" class="anchor"></a>
```cpp
public UFile createFile(String fileName, FileMode fmode)
```
Creates a file inside the directory.
#### Parameters
* `String` fileName - The name of the file to create.
#### Returns
A File object if successful, NULL if not.
<hr />
### `remove` <a id="class_folder_1aca893daac6c6747895d50987cf9cf34c" class="anchor"></a>
```cpp
public bool remove()
```
Removes a directory.
#### Parameters
* `dirname` The name of the directory to remove.
#### Returns
True if the directory was removed successfully, false otherwise.
<hr />
### `rename` <a id="class_folder_1adcbb7766d628810f716887d1e7e8d36f" class="anchor"></a>
```cpp
public bool rename(const char * newDirname)
```
Renames a directory.
#### Parameters
* `const` char * newDirname The new name of the directory.
#### Returns
True if the directory was renamed successfully, false otherwise.
<hr />
### `rename` <a id="class_folder_1a14519c2a344ebfb8161c2bee2a2b5464" class="anchor"></a>
```cpp
public bool rename(String newDirname)
```
Renames a directory.
#### Parameters
* `String` newDirname The new name of the directory.
#### Returns
True if the directory was renamed successfully, false otherwise.
<hr />
### `exists` <a id="class_folder_1aa548278d3ec09fd4abcaa827a79c40f4" class="anchor"></a>
```cpp
public bool exists()
```
Checks if the directory exists.
#### Returns
True if the directory exists, false otherwise.
<hr />
### `getPath` <a id="class_folder_1a0ef68289c526f8bf24020389c4e09e86" class="anchor"></a>
```cpp
public const char * getPath()
```
Returns the path of the file.
#### Returns
The path of the file as a const char *
<hr />
### `getPathAsString` <a id="class_folder_1ac816d0fe5674c4648e97423b6f9c51f8" class="anchor"></a>
```cpp
public String getPathAsString()
```
Returns the path of the file.
#### Returns
The path of the file as an Arduino String
<hr />
### `createSubfolder` <a id="class_folder_1a78f2f9b297f62b67c2e0656b15a95868" class="anchor"></a>
```cpp
public Folder createSubfolder(const char * subfolderName, bool overwrite)
```
Creates a subfolder in the directory.
#### Parameters
* `const` char * subfolderName - he name of the subfolder to create.
* `overwrite` - behaviour in case the folder already exists, default is false
#### Returns
The created subfolder.
<hr />
### `createSubfolder` <a id="class_folder_1ab50743664becb7b2a1fb564b5513d69c" class="anchor"></a>
```cpp
public Folder createSubfolder(String subfolderName, bool overwrite)
```
Creates a subfolder in the directory.
#### Parameters
* `String` subfolderName - he name of the subfolder to create.
* `overwrite` - behaviour in case the folder already exists, default is false
#### Returns
The created subfolder.
<hr />
### `getFiles` <a id="class_folder_1a2e7f604d19b8ad61524f86ade86ed4ad" class="anchor"></a>
```cpp
public std::vector< UFile > getFiles()
```
Returns File objects for all files in the current directory.
#### Returns
A std::vector of File objects representing the files in the directory.
<hr />
### `getFolders` <a id="class_folder_1a5554b8cc2fd1ca39dfccbd06bc635e10" class="anchor"></a>
```cpp
public std::vector< Folder > getFolders()
```
Returns [Folder](#class_folder) objects for all files in the current directory.
#### Returns
A std::vector of [Folder](#class_folder) objects representing the files in the directory.
<hr />
### `copyTo` <a id="class_folder_1aabf0818b7ee45b2d871e82e86edb4ebd" class="anchor"></a>
```cpp
public bool copyTo( Folder destination, bool overwrite)
```
Copies the current directory.
#### Parameters
* `[Folder](#class_folder)` destination - a [Folder](#class_folder) object representing the destination
#### Returns
True upon success, false otherwise.
<hr />
### `copyTo` <a id="class_folder_1a058d193f53c559eefe343b30797500eb" class="anchor"></a>
```cpp
public bool copyTo(const char * destination, bool overwrite)
```
Copies the current directory.
#### Parameters
* `const` char * destination - the path of the destination location
* `overwrite` - behaviour in case the folder already exists, default is false
#### Returns
True upon success, false otherwise.
<hr />
### `copyTo` <a id="class_folder_1a3162979e4c679c7f5503cc4584949714" class="anchor"></a>
```cpp
public bool copyTo(String destination, bool overwrite)
```
Copies the current directory.
#### Parameters
* `String` destination - the path of the destination location
* `overwrite` - behaviour in case the folder already exists, default is false
#### Returns
True upon success, false otherwise.
<hr />
### `moveTo` <a id="class_folder_1a5002b388b7e503ba79a8623ca6c1cbbd" class="anchor"></a>
```cpp
public bool moveTo( Folder destination, bool overwrite)
```
Moves the current directory.
#### Parameters
* `[Folder](#class_folder)` destination - a [Folder](#class_folder) object representing the destination
* `overwrite` - behaviour in case the folder already exists, default is false
#### Returns
True upon success, false otherwise.
<hr />
### `moveTo` <a id="class_folder_1a0ab690abfff790a2bd9fff3dd5976e82" class="anchor"></a>
```cpp
public bool moveTo(const char * destination, bool overwrite)
```
Moves the current directory.
#### Parameters
* `const` char * destination - the path of the destination location
* `overwrite` - behaviour in case the folder already exists, default is false
#### Returns
True upon success, false otherwise.
<hr />
### `moveTo` <a id="class_folder_1a3125db272185165a03b891efe5985a32" class="anchor"></a>
```cpp
public bool moveTo(String destination, bool overwrite)
```
Move the current directory.
#### Parameters
* `String` destination - the path of the destination location
* `overwrite` - behaviour in case the folder already exists, default is false
#### Returns
True upon success, false otherwise.
<hr />
# class `InternalStorage` <a id="class_internal_storage" class="anchor"></a>
```cpp
class InternalStorage
: public Arduino_UnifiedStorage
```
Represents internal storage using the Arduino Unified Storage library.
## Summary
Members | Descriptions
--------------------------------|---------------------------------------------
| [`InternalStorage`](#class_internal_storage_1ac45948ef554bc659efed81240140192e) | Constructs an [InternalStorage](#class_internal_storage) object with default settings. If no partitions are available, it restores the default partitioning scheme (See [restoreDefaultPartitions()](#class_internal_storage_1aa437dd0c91b3481f93fcd8239ed6dc82) for more info). If partitions are available, it sets the partition number, file system type, and partition name based on the last partition available. When using the default partitioning scheme the last partition would be the user partition. |
| [`InternalStorage`](#class_internal_storage_1ac13cad019a2ae66647d1c3604690eca7) | Constructs an [InternalStorage](#class_internal_storage) object with the specified partition, name, and file system. |
| [`begin`](#class_internal_storage_1a984731348dfbdade84e24250133a033e) | Initializes the internal storage. |
| [`begin`](#class_internal_storage_1a90cd409874d9c578ce3add4df88875e5) | Initializes the internal storage with the specified file system. |
| [`unmount`](#class_internal_storage_1a663446e2135a4e91d7fdb8ca638cc027) | Unmounts the internal storage. |
| [`getRootFolder`](#class_internal_storage_1a87142ddbdad62217e33851b32572082d) | Retrieves the root folder of the internal storage. |
| [`format`](#class_internal_storage_1a9ee819a55de5d411e6b10bdc9942c601) | Formats the internal storage with the selected file system. |
| [`getBlockDevice`](#class_internal_storage_1af347558e09045a5dd868f93b24286bab) | Retrieves the block device associated with the internal storage. |
| [`partition`](#class_internal_storage_1aa184679273e351e17a3a713d36aba6aa) | Partitions the internal storage according to the partitioning scheme given in the `partitions` parameter erasing the existing partitions |
| [`partition`](#class_internal_storage_1a6e9670923ace01a0ffba456ae460b1bb) | Creates one partition spanning over the whole size of the internal storage drive erasing the existing partitions. |
| [`restoreDefaultPartitions`](#class_internal_storage_1aa437dd0c91b3481f93fcd8239ed6dc82) | Restores the default partitioning scheme (1MB FAT32 for Certificates, 5MB FAT32 for OTA, 8MB user storage) to the internal storage drive erasing the existing partitions. |
| [`readPartitions`](#class_internal_storage_1a044927dfb048440a9c73985af9c3cf80) | Reads the partitioning scheme from the MBR sector of the internal storage drive and returns a vector of structs of type [Partition](#struct_partition) that represents the partitioning scheme |
## Members
### `InternalStorage` <a id="class_internal_storage_1ac45948ef554bc659efed81240140192e" class="anchor"></a>
```cpp
public InternalStorage()
```
Constructs an [InternalStorage](#class_internal_storage) object with default settings. If no partitions are available, it restores the default partitioning scheme (See [restoreDefaultPartitions()](#class_internal_storage_1aa437dd0c91b3481f93fcd8239ed6dc82) for more info). If partitions are available, it sets the partition number, file system type, and partition name based on the last partition available. When using the default partitioning scheme the last partition would be the user partition.
<hr />
### `InternalStorage` <a id="class_internal_storage_1ac13cad019a2ae66647d1c3604690eca7" class="anchor"></a>
```cpp
public InternalStorage(int partition, const char * name, FileSystems fs)
```
Constructs an [InternalStorage](#class_internal_storage) object with the specified partition, name, and file system.
#### Parameters
* `partition` The partition number.
* `name` The name of the partition.
* `fs` The desired file system (FS_FAT or FS_LITTLEFS).
<hr />
### `begin` <a id="class_internal_storage_1a984731348dfbdade84e24250133a033e" class="anchor"></a>
```cpp
public virtual bool begin()
```
Initializes the internal storage.
#### Returns
true if successful, false if failed.
<hr />
### `begin` <a id="class_internal_storage_1a90cd409874d9c578ce3add4df88875e5" class="anchor"></a>
```cpp
public virtual bool begin(FileSystems fs)
```
Initializes the internal storage with the specified file system.
#### Parameters
* `fs` The desired file system (FS_FAT or FS_LITTLEFS).
#### Returns
true if successful, false if failed.
<hr />
### `unmount` <a id="class_internal_storage_1a663446e2135a4e91d7fdb8ca638cc027" class="anchor"></a>
```cpp
public virtual bool unmount()
```
Unmounts the internal storage.
#### Returns
true if successful, false if failed.
<hr />
### `getRootFolder` <a id="class_internal_storage_1a87142ddbdad62217e33851b32572082d" class="anchor"></a>
```cpp
public virtual Folder getRootFolder()
```
Retrieves the root folder of the internal storage.
#### Returns
The root folder as a [Folder](#class_folder) object.
<hr />
### `format` <a id="class_internal_storage_1a9ee819a55de5d411e6b10bdc9942c601" class="anchor"></a>
```cpp
public virtual bool format(FileSystems fs)
```
Formats the internal storage with the selected file system.
#### Returns
true if successful, false if failed.
<hr />
### `getBlockDevice` <a id="class_internal_storage_1af347558e09045a5dd868f93b24286bab" class="anchor"></a>
```cpp
public BlockDeviceType * getBlockDevice()
```
Retrieves the block device associated with the internal storage.
#### Returns
The block device as a BlockDevice object.
<hr />
### `partition` <a id="class_internal_storage_1aa184679273e351e17a3a713d36aba6aa" class="anchor"></a>
```cpp
public static bool partition(std::vector< Partition > partitions)
```
Partitions the internal storage according to the partitioning scheme given in the `partitions` parameter erasing the existing partitions
#### Parameters
* `partitions` - vector of structs of type [Partition](#struct_partition) that represents the partitioning scheme
#### Returns
true if successful, false if failed.
<hr />
### `partition` <a id="class_internal_storage_1a6e9670923ace01a0ffba456ae460b1bb" class="anchor"></a>
```cpp
public static bool partition()
```
Creates one partition spanning over the whole size of the internal storage drive erasing the existing partitions.
#### Returns
true if successful, false if failed.
<hr />
### `restoreDefaultPartitions` <a id="class_internal_storage_1aa437dd0c91b3481f93fcd8239ed6dc82" class="anchor"></a>
```cpp
public static bool restoreDefaultPartitions()
```
Restores the default partitioning scheme (1MB FAT32 for Certificates, 5MB FAT32 for OTA, 8MB user storage) to the internal storage drive erasing the existing partitions.
#### Returns
true if successful, false if failed.
<hr />
### `readPartitions` <a id="class_internal_storage_1a044927dfb048440a9c73985af9c3cf80" class="anchor"></a>
```cpp
public static std::vector< Partition > readPartitions()
```
Reads the partitioning scheme from the MBR sector of the internal storage drive and returns a vector of structs of type [Partition](#struct_partition) that represents the partitioning scheme
#### Returns
vector of structs of type [Partition](#struct_partition)
<hr />
# class `Partitioning` <a id="class_partitioning" class="anchor"></a>
## Summary
Members | Descriptions
--------------------------------|---------------------------------------------
| [`eraseMBRSector`](#class_partitioning_1a21c0af41e2f29f3290dee36eb0f0d0b7) | Erases the first block (4096 bytes) of the BlockDevice to delete any already existing MBR partition table |
| [`partitionDrive`](#class_partitioning_1a450e1491d5d58d5d082dba6d45561b0f) | Partitions the BlockDevice according to the partitioning schemme given by the vector of [Partition](#struct_partition) structs |
| [`readPartitions`](#class_partitioning_1a21af9f41711668d2f80fb0c74ce9168f) | Reads and unpacks the MBR partition information and returns a list of partitions it can find on the drive |
## Members
### `eraseMBRSector` <a id="class_partitioning_1a21c0af41e2f29f3290dee36eb0f0d0b7" class="anchor"></a>
```cpp
public static bool eraseMBRSector(BlockDeviceType * blockDevice)
```
Erases the first block (4096 bytes) of the BlockDevice to delete any already existing MBR partition table
#### Parameters
* `The` BlockDevice on which the MBR sector is situated.
#### Returns
True upon success, False on failure
<hr />
### `partitionDrive` <a id="class_partitioning_1a450e1491d5d58d5d082dba6d45561b0f" class="anchor"></a>
```cpp
public static bool partitionDrive(BlockDeviceType * blockDevice, std::vector< Partition > partitions)
```
Partitions the BlockDevice according to the partitioning schemme given by the vector of [Partition](#struct_partition) structs
#### Parameters
* `blockDevice` - the BlockDevice which we would like to partition.
* `partitions` - a vector of [Partition](#struct_partition) structs that represents the partitioning scheme
#### Returns
True upon success, False on failure
<hr />
### `readPartitions` <a id="class_partitioning_1a21af9f41711668d2f80fb0c74ce9168f" class="anchor"></a>
```cpp
public static std::vector< Partition > readPartitions(BlockDeviceType * blockDevice)
```
Reads and unpacks the MBR partition information and returns a list of partitions it can find on the drive
#### Parameters
* `blockDevice` on which the MBR sector is situated.
#### Returns
std::vector of [Partition](#struct_partition) containing size and filesystem information about each partition
<hr />
# class `SDStorage` <a id="class_s_d_storage" class="anchor"></a>
```cpp
class SDStorage
: public Arduino_UnifiedStorage
```
Represents an SD card storage using the Arduino Unified Storage library.
## Summary
Members | Descriptions
--------------------------------|---------------------------------------------
| [`SDStorage`](#class_s_d_storage_1a992cb710f41462a7a35c6dfdc838f01f) | Default constructor for the [SDStorage](#class_s_d_storage) class. |
| [`begin`](#class_s_d_storage_1ab49c772b785b6c97940baca60ae386ec) | Initializes the SD card storage. |
| [`begin`](#class_s_d_storage_1a19520df98c5a52d403ac26a873f65860) | Initializes the SD card storage with the specified file system. |
| [`unmount`](#class_s_d_storage_1a6f4d671e685d660d0aff8648d8288b9c) | Unmounts the SD card storage. |
| [`getRootFolder`](#class_s_d_storage_1a2f7327c327985d88bd1305310ec0c5e8) | Retrieves the root folder of the SD card storage. |
| [`format`](#class_s_d_storage_1a93cac8330a5950138985e3712db1dc07) | Formats the SD card storage with the selected file system. |
## Members
### `SDStorage` <a id="class_s_d_storage_1a992cb710f41462a7a35c6dfdc838f01f" class="anchor"></a>
```cpp
public SDStorage()
```
Default constructor for the [SDStorage](#class_s_d_storage) class.
<hr />
### `begin` <a id="class_s_d_storage_1ab49c772b785b6c97940baca60ae386ec" class="anchor"></a>
```cpp
public virtual bool begin()
```
Initializes the SD card storage.
#### Returns
true if successful, false if failed.
<hr />
### `begin` <a id="class_s_d_storage_1a19520df98c5a52d403ac26a873f65860" class="anchor"></a>
```cpp
public virtual bool begin(FileSystems fs)
```
Initializes the SD card storage with the specified file system.
#### Parameters
* `fs` The desired file system (FS_FAT or FS_LITTLEFS).
#### Returns
true if successful, false if failed.
<hr />
### `unmount` <a id="class_s_d_storage_1a6f4d671e685d660d0aff8648d8288b9c" class="anchor"></a>
```cpp
public virtual bool unmount()
```
Unmounts the SD card storage.
#### Returns
true if successful, false if failed.
<hr />
### `getRootFolder` <a id="class_s_d_storage_1a2f7327c327985d88bd1305310ec0c5e8" class="anchor"></a>
```cpp
public virtual Folder getRootFolder()
```
Retrieves the root folder of the SD card storage.
#### Returns
The root folder as a [Folder](#class_folder) object.
<hr />
### `format` <a id="class_s_d_storage_1a93cac8330a5950138985e3712db1dc07" class="anchor"></a>
```cpp
public virtual bool format(FileSystems fs)
```
Formats the SD card storage with the selected file system.
#### Returns
true if successful, false if failed.
<hr />
# class `UFile` <a id="class_u_file" class="anchor"></a>
Class representing a File
## Summary
Members | Descriptions
--------------------------------|---------------------------------------------
| [`UFile`](#class_u_file_1a2a04504d0135d28465e0547bec062ebf) | Constructor. |
| [`UFile`](#class_u_file_1acdd969b1c2f115fc105f6d08bd67b121) | Constructor. |
| [`~UFile`](#class_u_file_1a4f74e28f98898e3603140b6409fa52ba) | |
| [`changeMode`](#class_u_file_1a744ad88f2037e87e3f5375c7aec28f6d) | Closes the file, and opens it again with a new file mode. |
| [`open`](#class_u_file_1aa52ff2913386374e6e83ba35f595d213) | Opens a file with the specified mode. |
| [`open`](#class_u_file_1a0247abf7053b47463f73ca8cb1c7c23c) | Opens a file with the specified mode. |
| [`close`](#class_u_file_1ab5731b8e40a87a44a7322bf151597c55) | Closes the file and releases any allocated resources. |
| [`seek`](#class_u_file_1aa117a19e5efe6508e5e87ab65abbb560) | Seeks to a specific position in the file. |
| [`read`](#class_u_file_1a8192f041831d58ba8186798676c5ad3a) | Reads data from the file into a buffer. |
| [`readAsString`](#class_u_file_1ad70a29b0e436906bdaa7b99e3fc9e1b3) | Reads the contents of the file as an Arduino String. |
| [`write`](#class_u_file_1a16625e123db35bf19f9088828d9e1305) | Writes data to the file from a buffer. |
| [`write`](#class_u_file_1a68ee9ecdb0a6efd9816f3382de67905e) | Writes a string to the file. |
| [`remove`](#class_u_file_1a0e9efb7c54053b6f507f6caa704fc101) | Removes the file. |
| [`rename`](#class_u_file_1a0511c1a498bcbce549b49db9e188c2c0) | Renames the file. |
| [`rename`](#class_u_file_1a2122cd3e0e16481ecaff1af897790c03) | Renames the file. |
| [`exists`](#class_u_file_1a4963afa70289718a3bd1ca50b6adb420) | Checks if the file exists. |
| [`copyTo`](#class_u_file_1a6178616dea1a897b0e4033dfdc7bc41d) | Copies the file to the specified destination path. |
| [`copyTo`](#class_u_file_1a908edbee6d38619798d63f72f8f58dd1) | Copies the file to the specified destination path. |
| [`copyTo`](#class_u_file_1a9e06719446533b73505a6f6a66091fa7) | Copies the file to the specified destination path. |
| [`moveTo`](#class_u_file_1abadd4af5700d94b2c3d74dd4dce51bdc) | Moves the file to the specified destination path. |
| [`moveTo`](#class_u_file_1ae676e42f3e5ad423da3386985fc8261f) | Moves the file to the specified destination path. |
| [`moveTo`](#class_u_file_1a69f6a7cccce8cc40eb6698df15f38635) | Copies the file to the specified destination folder. |
| [`getParentFolder`](#class_u_file_1a087b79b6d62a3ed122d1f8b0f25b0d24) | Returns a reference to the parent folder of the current folder. |
| [`getPath`](#class_u_file_1a122edcf553a8929b703d70c6aa8a6e80) | Returns the path of the directory. |
| [`getPathAsString`](#class_u_file_1a5adef9f3d538f92e51e52c4b1f3ada76) | Returns the path of the directory. |
| [`available`](#class_u_file_1a82ad0fb6cffaf23aea794b508ec57bbb) | Returns the number of bytes available to read. |
| [`read`](#class_u_file_1a62b544ebe9c3b144268016e6427917b5) | Returns one byte from the file. |
| [`write`](#class_u_file_1a4db87498c1a4205145816c14df704de7) | Writes one byte to the file. |
## Members
### `UFile` <a id="class_u_file_1a2a04504d0135d28465e0547bec062ebf" class="anchor"></a>
```cpp
public UFile()
```
Constructor.
<hr />
### `UFile` <a id="class_u_file_1acdd969b1c2f115fc105f6d08bd67b121" class="anchor"></a>
```cpp
public UFile(const char * path)
```
Constructor.
#### Parameters
* `const` char * path - path of the file
<hr />
### `~UFile` <a id="class_u_file_1a4f74e28f98898e3603140b6409fa52ba" class="anchor"></a>
```cpp
public ~UFile()
```
<hr />
### `changeMode` <a id="class_u_file_1a744ad88f2037e87e3f5375c7aec28f6d" class="anchor"></a>
```cpp
public bool changeMode(FileMode mode)
```
Closes the file, and opens it again with a new file mode.
#### Parameters
* `mode` The file mode (READ, WRITE, or APPEND).
#### Returns
True if operation was successful, false otherwise.
<hr />
### `open` <a id="class_u_file_1aa52ff2913386374e6e83ba35f595d213" class="anchor"></a>
```cpp
public bool open(const char * filename, FileMode mode)
```
Opens a file with the specified mode.
#### Parameters
* `const` char * filename - The name of the file to open.
* `mode` The file mode (READ, WRITE, or APPEND).
#### Returns
True if the file was opened successfully, false otherwise.
<hr />
### `open` <a id="class_u_file_1a0247abf7053b47463f73ca8cb1c7c23c" class="anchor"></a>
```cpp
public bool open(String filename, FileMode mode)
```
Opens a file with the specified mode.
#### Parameters
* `String` filename - The name of the file to open.
* `mode` The file mode (READ, WRITE, or APPEND).
#### Returns
True if the file was opened successfully, false otherwise.
<hr />
### `close` <a id="class_u_file_1ab5731b8e40a87a44a7322bf151597c55" class="anchor"></a>
```cpp
public void close()
```
Closes the file and releases any allocated resources.
<hr />
### `seek` <a id="class_u_file_1aa117a19e5efe6508e5e87ab65abbb560" class="anchor"></a>
```cpp
public bool seek(size_t offset)
```
Seeks to a specific position in the file.
#### Parameters
* `offset` The offset from the beginning of the file.
#### Returns
True if the seek operation was successful, false otherwise.
<hr />
### `read` <a id="class_u_file_1a8192f041831d58ba8186798676c5ad3a" class="anchor"></a>
```cpp
public size_t read(uint8_t * buffer, size_t size)
```
Reads data from the file into a buffer.
#### Parameters
* `buffer` The buffer to read data into.
* `size` The size of the buffer.
#### Returns
The number of bytes read from the file.
<hr />
### `readAsString` <a id="class_u_file_1ad70a29b0e436906bdaa7b99e3fc9e1b3" class="anchor"></a>
```cpp
public String readAsString()
```
Reads the contents of the file as an Arduino String.
#### Returns
The file contents as a String.
<hr />
### `write` <a id="class_u_file_1a16625e123db35bf19f9088828d9e1305" class="anchor"></a>
```cpp
public size_t write(const uint8_t * buffer, size_t size)
```
Writes data to the file from a buffer.
#### Parameters
* `buffer` The buffer containing the data to write.
* `size` The size of the data to write.
#### Returns
The number of bytes written to the file.
<hr />
### `write` <a id="class_u_file_1a68ee9ecdb0a6efd9816f3382de67905e" class="anchor"></a>
```cpp
public size_t write(String)
```
Writes a string to the file.
#### Parameters
* `data` The string to write.
#### Returns
The number of bytes written to the file.
<hr />
### `remove` <a id="class_u_file_1a0e9efb7c54053b6f507f6caa704fc101" class="anchor"></a>
```cpp
public bool remove()
```
Removes the file.
#### Returns
True if the file was removed successfully, false otherwise.
<hr />
### `rename` <a id="class_u_file_1a0511c1a498bcbce549b49db9e188c2c0" class="anchor"></a>
```cpp
public bool rename(const char * newFilename)
```
Renames the file.
#### Parameters
* `const` char * newFilename The new name of the file.
#### Returns
True if the file was renamed successfully, false otherwise.
<hr />
### `rename` <a id="class_u_file_1a2122cd3e0e16481ecaff1af897790c03" class="anchor"></a>
```cpp