loadInfo()
Description
Gets a promise with an object with the information on file system (total and used space)info
The loadInfo() method is a part of the RestDataProvider service intended for working with the server
Usage
loadInfo(id?: string): Promise<void | obj[]>;
Parameters
id - (optional) the id of a folder where data about folder will be loaded (which is a path to the folder)
Returns
The loadInfo() method returns a promise with the data on file system.
If the id parameter is sent in the request line the response will we as in the example below:
{
"Size": 47597382, // the folder size
"Count": 17 // the number of items in the folder
}
If the id parameter is not sent in the request then the method returns an object as in the example below:
{
"free": 0,
"total": 467300933632,
"used": 229621727232
}
Examples
<script setup>
import { RestDataProvider } from "@svar-ui/filemanager-data-provider";
import { Filemanager } from "@svar-ui/vue-filemanager";
import { ref } from "vue";
const url = "https://some-backend-url";
const restProvider = new RestDataProvider(url);
const data = ref([]);
const drive = ref({});
function init(api) {
api.setNext(restProvider);
}
Promise.all([restProvider.loadFiles(), restProvider.loadInfo()]).then(([files, info]) => {
data.value = files;
drive.value = info.stats;
});
</script>
<template>
<Filemanager
:init="init"
:data="data"
:drive="drive" />
</template>
Related articles: