1# @ohos.file.storageStatistics (Application Storage Statistics) 2 3The **storageStatistics** module provides APIs for obtaining storage space information, including the space of built-in and plug-in memory cards, space occupied by different types of data, and space of application data. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```js 12import storageStatistics from "@ohos.file.storageStatistics"; 13``` 14 15## storageStatistics.getTotalSizeOfVolume 16 17getTotalSizeOfVolume(volumeUuid: string): Promise<number> 18 19Obtains the total size (in bytes) of the specified volume in an external storage device. This API uses a promise to return the result. 20 21**Required permissions**: ohos.permission.STORAGE_MANAGER 22 23**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 24 25**System API**: This is a system API. 26 27**Parameters** 28 29 | Name | Type | Mandatory| Description| 30 | ---------- | ------ | ---- | ---- | 31 | volumeUuid | string | Yes | UUID of the volume.| 32 33**Return value** 34 35 | Type | Description | 36 | --------------------- | ---------------- | 37 | Promise<number> | Promise used to return the total volume size obtained.| 38 39**Error codes** 40 41For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 42 43| ID| Error Message| 44| -------- | -------- | 45| 201 | Permission verification failed. | 46| 202 | The caller is not a system application. | 47| 401 | The input parameter is invalid. | 48| 13600001 | IPC error. | 49| 13600008 | No such object. | 50| 13900032 | Unknown error. | 51 52**Example** 53 54 ```js 55 let uuid = ""; 56 storageStatistics.getTotalSizeOfVolume(uuid).then(function(number){ 57 console.info("getTotalSizeOfVolume successfully:"+ number); 58 }).catch(function(err){ 59 console.info("getTotalSizeOfVolume failed with error:"+ err); 60 }); 61 ``` 62 63## storageStatistics.getTotalSizeOfVolume 64 65getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void 66 67Obtains the total size (in bytes) of the specified volume in an external storage device. This API uses an asynchronous callback to return the result. 68 69**Required permissions**: ohos.permission.STORAGE_MANAGER 70 71**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 72 73**System API**: This is a system API. 74 75**Parameters** 76 77 | Name | Type | Mandatory| Description | 78 | ---------- | ------------------------------------ | ---- | -------------------------- | 79 | volumeUuid | string | Yes | UUID of the volume. | 80 | callback | AsyncCallback<number> | Yes | Callback invoked to return the total volume size obtained.| 81 82**Error codes** 83 84For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 85 86| ID| Error Message| 87| -------- | -------- | 88| 201 | Permission verification failed. | 89| 202 | The caller is not a system application. | 90| 401 | The input parameter is invalid. | 91| 13600001 | IPC error. | 92| 13600008 | No such object. | 93| 13900032 | Unknown error. | 94 95**Example** 96 97 ```js 98 let uuid = ""; 99 storageStatistics.getTotalSizeOfVolume(uuid, function(error, number){ 100 // Do something. 101 console.info("getTotalSizeOfVolume successfully:"+ number); 102 }); 103 ``` 104 105## storageStatistics.getFreeSizeOfVolume 106 107getFreeSizeOfVolume(volumeUuid: string): Promise<number> 108 109Obtains the available space (in bytes) of the specified volume in an external storage device. This API uses a promise to return the result. 110 111**Required permissions**: ohos.permission.STORAGE_MANAGER 112 113**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 114 115**System API**: This is a system API. 116 117**Parameters** 118 119 | Name | Type | Mandatory| Description| 120 | ---------- | ------ | ---- | ---- | 121 | volumeUuid | string | Yes | UUID of the volume.| 122 123**Return value** 124 125 | Type | Description | 126 | --------------------- | ------------------ | 127 | Promise<number> | Promise used to return the available volume space obtained.| 128 129**Error codes** 130 131For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 132 133| ID| Error Message| 134| -------- | -------- | 135| 201 | Permission verification failed. | 136| 202 | The caller is not a system application. | 137| 401 | The input parameter is invalid. | 138| 13600001 | IPC error. | 139| 13600008 | No such object. | 140| 13900032 | Unknown error. | 141 142**Example** 143 144 ```js 145 let uuid = ""; 146 storageStatistics.getFreeSizeOfVolume(uuid).then(function(number){ 147 console.info("getFreeSizeOfVolume successfully:"+ number); 148 }).catch(function(err){ 149 console.info("getFreeSizeOfVolume failed with error:"+ err); 150 }); 151 152 ``` 153 154## storageStatistics.getFreeSizeOfVolume 155 156getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void 157 158Obtains the available space (in bytes) of the specified volume in an external storage device. This API uses an asynchronous callback to return the result. 159 160**Required permissions**: ohos.permission.STORAGE_MANAGER 161 162**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 163 164**System API**: This is a system API. 165 166**Parameters** 167 168 | Name | Type | Mandatory| Description | 169 | ---------- | ------------------------------------ | ---- | ---------------------------- | 170 | volumeUuid | string | Yes | UUID of the volume. | 171 | callback | AsyncCallback<number> | Yes | Callback invoked to return the available volume space obtained.| 172 173**Error codes** 174 175For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 176 177| ID| Error Message| 178| -------- | -------- | 179| 201 | Permission verification failed. | 180| 202 | The caller is not a system application. | 181| 401 | The input parameter is invalid. | 182| 13600001 | IPC error. | 183| 13600008 | No such object. | 184| 13900032 | Unknown error. | 185 186**Example** 187 188 ```js 189 let uuid = ""; 190 storageStatistics.getFreeSizeOfVolume(uuid, function(error, number){ 191 // Do something. 192 console.info("getFreeSizeOfVolume successfully:"+ number); 193 }); 194 ``` 195 196## storageStatistics.getBundleStats<sup>9+</sup> 197 198getBundleStats(packageName: string): Promise<BundleStats> 199 200Obtains the space (in bytes) of an application. This API uses a promise to return the result. 201 202**Required permissions**: ohos.permission.STORAGE_MANAGER 203 204**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 205 206**System API**: This is a system API. 207 208**Parameters** 209 210 | Name | Type | Mandatory| Description | 211 | ----------- | ------ | ---- | -------- | 212 | packageName | string | Yes | Bundle name of the application.| 213 214**Return value** 215 216 | Type | Description | 217 | ------------------------------------------ | -------------------------- | 218 | Promise<[Bundlestats](#bundlestats9)> | Promise used to return the application space obtained.| 219 220**Error codes** 221 222For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 223 224| ID| Error Message| 225| -------- | -------- | 226| 201 | Permission verification failed. | 227| 202 | The caller is not a system application. | 228| 401 | The input parameter is invalid. | 229| 13600001 | IPC error. | 230| 13600008 | No such object. | 231| 13900032 | Unknown error. | 232 233**Example** 234 235 ```js 236 let packageName = ""; 237 storageStatistics.getBundleStats(packageName).then(function(BundleStats){ 238 console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats)); 239 }).catch(function(err){ 240 console.info("getBundleStats failed with error:"+ err); 241 }); 242 ``` 243 244## storageStatistics.getBundleStats<sup>9+</sup> 245 246getBundleStats(packageName: string, callback: AsyncCallback<BundleStats>): void 247 248Obtains the space (in bytes) of an application. This API uses an asynchronous callback to return the result. 249 250**Required permissions**: ohos.permission.STORAGE_MANAGER 251 252**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 253 254**System API**: This is a system API. 255 256**Parameters** 257 258 | Name | Type | Mandatory| Description | 259 | -------- | --------------------------------------------------------- | ---- | ------------------------------------ | 260 | packageName | string | Yes | Bundle name of the application.| 261 | callback | AsyncCallback<[Bundlestats](#bundlestats9)> | Yes | Callback invoked to return the application space obtained.| 262 263**Error codes** 264 265For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 266 267| ID| Error Message| 268| -------- | -------- | 269| 201 | Permission verification failed. | 270| 202 | The caller is not a system application. | 271| 401 | The input parameter is invalid. | 272| 13600001 | IPC error. | 273| 13600008 | No such object. | 274| 13900032 | Unknown error. | 275 276**Example** 277 278 ```js 279 let packageName = ""; 280 storageStatistics.getBundleStats(packageName, function(error, BundleStats){ 281 // Do something. 282 console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats)); 283 }); 284 ``` 285 286## storageStatistics.getCurrentBundleStats<sup>9+</sup> 287 288getCurrentBundleStats(): Promise<BundleStats> 289 290Obtains the space (in bytes) of this third-party application. This API uses a promise to return the result. 291 292**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 293 294**Return value** 295 296 | Type | Description | 297 | ------------------------------------------ | -------------------------- | 298 | Promise<[Bundlestats](#bundlestats9)> | Promise used to return the application space obtained. | 299 300**Error codes** 301 302For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 303 304| ID| Error Message| 305| -------- | -------- | 306| 401 | The input parameter is invalid. | 307| 13600001 | IPC error. | 308| 13900032 | Unknown error. | 309 310**Example** 311 312 ```js 313 let bundleStats = storageStatistics.getCurrentBundleStats(); 314 console.info("getCurrentBundleStats successfully:"+ JSON.stringify(bundleStats)); 315 ``` 316 317## storageStatistics.getCurrentBundleStats<sup>9+</sup> 318 319getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void 320 321Obtains the space (in bytes) of this third-party application. This API uses an asynchronous callback to return the result. 322 323**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 324 325**Parameters** 326 327 | Name | Type | Mandatory | Description | 328 | -------- | --------------------------------------------------------- | ---- | ------------------------------------ | 329 | callback | AsyncCallback<[BundleStats](#bundlestats9)> | Yes | Callback invoked to return the application space obtained. | 330 331**Error codes** 332 333For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 334 335| ID| Error Message| 336| -------- | -------- | 337| 401 | The input parameter is invalid. | 338| 13600001 | IPC error. | 339| 13900032 | Unknown error. | 340 341**Example** 342 343 ```js 344 storageStatistics.getCurrentBundleStats(function(error, bundleStats){ 345 // Do something. 346 console.info("getCurrentBundleStats successfully:"+ JSON.stringify(bundleStats)); 347 }); 348 ``` 349 350## BundleStats<sup>9+</sup> 351 352**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 353 354| Name | Type | Readable| Writable| Description | 355| --------- | ------ | --- | ---- | -------------- | 356| appSize | number | Yes| No| Size of the application, in bytes. | 357| cacheSize | number | Yes| No| Cache size of the application, in bytes. | 358| dataSize | number | Yes| No| Total data size of the application, in bytes.| 359 360## storageStatistics.getTotalSize<sup>9+</sup> 361 362getTotalSize(): Promise<number> 363 364Obtains the total size (in bytes) of the built-in storage. This API uses a promise to return the result. 365 366**Required permissions**: ohos.permission.STORAGE_MANAGER 367 368**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 369 370**System API**: This is a system API. 371 372**Return value** 373 374 | Type | Description | 375 | --------------------- | ------------------ | 376 | Promise<number> | Promise used to return the built-in storage size obtained. | 377 378**Error codes** 379 380For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 381 382| ID| Error Message| 383| -------- | -------- | 384| 201 | Permission verification failed. | 385| 202 | The caller is not a system application. | 386| 401 | The input parameter is invalid. | 387| 13600001 | IPC error. | 388| 13900032 | Unknown error. | 389 390**Example** 391 392 ```js 393 let number = storageStatistics.getTotalSize(); 394 console.info("getTotalSize successfully:"+ JSON.stringify(number)); 395 ``` 396 397## storageStatistics.getTotalSize<sup>9+</sup> 398 399getTotalSize(callback: AsyncCallback<number>): void 400 401Obtains the total size (in bytes) of the built-in storage. This API uses an asynchronous callback to return the result. 402 403**Required permissions**: ohos.permission.STORAGE_MANAGER 404 405**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 406 407**System API**: This is a system API. 408 409**Parameters** 410 411 | Name | Type | Mandatory | Description | 412 | -------- | ------------------------------------ | ---- | ------------------------ | 413 | callback | AsyncCallback<number> | Yes | Callback invoked to return the built-in storage size obtained.| 414 415**Error codes** 416 417For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 418 419| ID| Error Message| 420| -------- | -------- | 421| 201 | Permission verification failed. | 422| 202 | The caller is not a system application. | 423| 401 | The input parameter is invalid. | 424| 13600001 | IPC error. | 425| 13900032 | Unknown error. | 426 427**Example** 428 429 ```js 430 storageStatistics.getTotalSize(function(error, number){ 431 // Do something. 432 console.info("getTotalSize successfully:"+ JSON.stringify(number)); 433 }); 434 ``` 435 436## storageStatistics.getFreeSize<sup>9+</sup> 437 438getFreeSize(): Promise<number> 439 440Obtains the available space (in bytes) of the built-in storage. This API uses a promise to return the result. 441 442**Required permissions**: ohos.permission.STORAGE_MANAGER 443 444**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 445 446**System API**: This is a system API. 447 448**Return value** 449 450 | Type | Description | 451 | --------------------- | ------------------ | 452 | Promise<number> | Promise used to return the available space of the built-in storage obtained.| 453 454**Error codes** 455 456For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 457 458| ID| Error Message| 459| -------- | -------- | 460| 201 | Permission verification failed. | 461| 202 | The caller is not a system application. | 462| 401 | The input parameter is invalid. | 463| 13600001 | IPC error. | 464| 13900032 | Unknown error. | 465 466**Example** 467 468 ```js 469 let number = storageStatistics.getFreeSize(); 470 console.info("getFreeSize successfully:"+ JSON.stringify(number)); 471 ``` 472 473## storageStatistics.getFreeSize<sup>9+</sup> 474 475getFreeSize(callback: AsyncCallback<number>): void 476 477Obtains the available space (in bytes) of the built-in storage. This API uses an asynchronous callback to return the result. 478 479**Required permissions**: ohos.permission.STORAGE_MANAGER 480 481**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 482 483**System API**: This is a system API. 484 485**Parameters** 486 487 | Name | Type | Mandatory| Description | 488 | -------- | ------------------------------------ | ---- | ------------------------- | 489 | callback | AsyncCallback<number> | Yes | Callback invoked to return the available space of the built-in storage obtained.| 490 491**Error codes** 492 493For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 494 495| ID| Error Message| 496| -------- | -------- | 497| 201 | Permission verification failed. | 498| 202 | The caller is not a system application. | 499| 401 | The input parameter is invalid. | 500| 13600001 | IPC error. | 501| 13900032 | Unknown error. | 502 503**Example** 504 505 ```js 506 storageStatistics.getFreeSize(function(error, number){ 507 // Do something. 508 console.info("getFreeSize successfully:"+ JSON.stringify(number)); 509 }); 510 ``` 511 512## storageStatistics.getSystemSize<sup>9+</sup> 513 514getSystemSize(): Promise<number> 515 516Obtains the system data space, in bytes. This API uses a promise to return the result. 517 518**Required permissions**: ohos.permission.STORAGE_MANAGER 519 520**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 521 522**System API**: This is a system API. 523 524**Return value** 525 526 | Type | Description | 527 | --------------------- | ---------------- | 528 | Promise<number> | Promise used to return the system data space obtained.| 529 530**Error codes** 531 532For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 533 534| ID| Error Message| 535| -------- | -------- | 536| 201 | Permission verification failed. | 537| 202 | The caller is not a system application. | 538| 401 | The input parameter is invalid. | 539| 13600001 | IPC error. | 540| 13900032 | Unknown error. | 541 542**Example** 543 544 ```js 545 storageStatistics.getSystemSize().then(function(number){ 546 console.info("getSystemSize successfully:"+ number); 547 }).catch(function(err){ 548 console.info("getSystemSize failed with error:"+ err); 549 }); 550 ``` 551 552## storageStatistics.getSystemSize<sup>9+</sup> 553 554getSystemSize(callback: AsyncCallback<number>): void 555 556Obtains the system data space, in bytes. This API uses an asynchronous callback to return the result. 557 558**Required permissions**: ohos.permission.STORAGE_MANAGER 559 560**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 561 562**System API**: This is a system API. 563 564**Parameters** 565 566 | Name | Type | Mandatory| Description | 567 | ---------- | ------------------------------------ | ---- | -------------------------- | 568 | callback | AsyncCallback<number> | Yes | Callback invoked to return the system data space obtained.| 569 570**Error codes** 571 572For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 573 574| ID| Error Message| 575| -------- | -------- | 576| 201 | Permission verification failed. | 577| 202 | The caller is not a system application. | 578| 401 | The input parameter is invalid. | 579| 13600001 | IPC error. | 580| 13900032 | Unknown error. | 581 582**Example** 583 584 ```js 585 storageStatistics.getSystemSize(function(error, number){ 586 // Do something. 587 console.info("getSystemSize successfully:"+ number); 588 }); 589 ``` 590 591## storageStatistics.getUserStorageStats<sup>9+</sup> 592 593getUserStorageStats(): Promise<StorageStats> 594 595Obtains the storage statistics (in bytes) of this user. This API uses a promise to return the result. 596 597**Required permissions**: ohos.permission.STORAGE_MANAGER 598 599**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 600 601**System API**: This is a system API. 602 603**Return value** 604 605 | Type | Description | 606 | --------------------- | ---------------- | 607 | Promise<[StorageStats](#storagestats9)> | Promise used to return the information obtained.| 608 609**Error codes** 610 611For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 612 613| ID| Error Message| 614| -------- | -------- | 615| 201 | Permission verification failed. | 616| 202 | The caller is not a system application. | 617| 401 | The input parameter is invalid. | 618| 13600001 | IPC error. | 619| 13900032 | Unknown error. | 620 621**Example** 622 623 ```js 624 storageStatistics.getUserStorageStats().then(function(StorageStats){ 625 console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); 626 }).catch(function(err){ 627 console.info("getUserStorageStats failed with error:"+ err); 628 }); 629 ``` 630 631## storageStatistics.getUserStorageStats<sup>9+</sup> 632 633getUserStorageStats(callback: AsyncCallback<StorageStats>): void 634 635Obtains the storage statistics (in bytes) of this user. This API uses an asynchronous callback to return the result. 636 637**Required permissions**: ohos.permission.STORAGE_MANAGER 638 639**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 640 641**System API**: This is a system API. 642 643**Parameters** 644 645 | Name | Type | Mandatory| Description | 646 | ---------- | ------------------------------------ | ---- | -------------------------- | 647 | callback | AsyncCallback<[StorageStats](#storagestats9)> | Yes | Callback invoked to return the information obtained.| 648 649**Error codes** 650 651For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 652 653| ID| Error Message| 654| -------- | -------- | 655| 201 | Permission verification failed. | 656| 202 | The caller is not a system application. | 657| 401 | The input parameter is invalid. | 658| 13600001 | IPC error. | 659| 13900032 | Unknown error. | 660 661**Example** 662 663 ```js 664 storageStatistics.getUserStorageStats(function(error, StorageStats){ 665 // Do something. 666 console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); 667 }); 668 ``` 669 670## storageStatistics.getUserStorageStats<sup>9+</sup> 671 672getUserStorageStats(userId: number): Promise<StorageStats> 673 674Obtains the storage statistics (in bytes) of the specified user. This API uses a promise to return the result. 675 676**Required permissions**: ohos.permission.STORAGE_MANAGER 677 678**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 679 680**System API**: This is a system API. 681 682**Parameters** 683 684 | Name | Type | Mandatory| Description| 685 | ---------- | ------ | ---- | ---- | 686 | userId | number | Yes | User ID.| 687 688**Return value** 689 690 | Type | Description | 691 | --------------------- | ---------------- | 692 | Promise<[StorageStats](#storagestats9)> | Promise used to return the information obtained.| 693 694**Error codes** 695 696For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 697 698| ID| Error Message| 699| -------- | -------- | 700| 201 | Permission verification failed. | 701| 202 | The caller is not a system application. | 702| 401 | The input parameter is invalid. | 703| 13600001 | IPC error. | 704| 13600009 | User if out of range. | 705| 13900032 | Unknown error. | 706 707**Example** 708 709 ```js 710 let userId = 100; 711 storageStatistics.getUserStorageStats(userId).then(function(StorageStats){ 712 console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); 713 }).catch(function(err){ 714 console.info("getUserStorageStats failed with error:"+ err); 715 }); 716 ``` 717 718## storageStatistics.getUserStorageStats<sup>9+</sup> 719 720getUserStorageStats(userId: number, callback: AsyncCallback<StorageStats>): void 721 722Obtains the storage statistics (in bytes) of the specified user. This API uses an asynchronous callback to return the result. 723 724**Required permissions**: ohos.permission.STORAGE_MANAGER 725 726**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 727 728**System API**: This is a system API. 729 730**Parameters** 731 732 | Name | Type | Mandatory| Description | 733 | ---------- | ------------------------------------ | ---- | -------------------------- | 734 | userId | number | Yes | User ID.| 735 | callback | AsyncCallback<[StorageStats](#storagestats9)> | Yes | Callback invoked to return the information obtained.| 736 737**Error codes** 738 739For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). 740 741| ID| Error Message| 742| -------- | -------- | 743| 201 | Permission verification failed. | 744| 202 | The caller is not a system application. | 745| 401 | The input parameter is invalid. | 746| 13600001 | IPC error. | 747| 13600009 | User if out of range. | 748| 13900032 | Unknown error. | 749 750**Example** 751 752 ```js 753 let userId = 100; 754 storageStatistics.getUserStorageStats(userId, function(error, StorageStats){ 755 // Do something. 756 console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); 757 }); 758 ``` 759 760## StorageStats<sup>9+</sup> 761 762**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics 763 764**System API**: This is a system API. 765 766| Name | Type | Readable | Writable | Description | 767| --------- | ------ | ---- | ----- | -------------- | 768| total | number | Yes| No| Total size of the built-in storage, in bytes. | 769| audio | number |Yes| No| Space occupied by audio data, in bytes. | 770| video | number | Yes| No| Space occupied by video data, in bytes.| 771| image | number | Yes| No| Space occupied by image data, in bytes. | 772| file | number | Yes| No| Space occupied by files, in bytes. | 773| app | number | Yes| No| Space occupied by application data, in bytes.| 774