Skip to main content

data

Description

Optional. An array of objects containing the files structure data

Usage

//file type
data?: [{
id: string,
type?: "file" | "folder",
size?: number,
lazy?: boolean,
date: Date {}
}] | []

Parameters

The property is an array of objects, where each object represents the file or folder entity. It is an empty array by default.

  • id - (required) the ID of an item. It's a path to a file or folder
  • size - (optional) the size of an item in bytes
  • date - (required) the Date object that represents the date of the entity
  • type - (optional) the type which can be "file" or "folder"
  • lazy - (optional) when set to true for the "folder" items, indicates that their content needs to be requested separately

Example

<script>
import { Filemanager } from "@wx/svelte-filemanager";

const rawdata = [
{
id: "/Code",
size: 4096,
date: new Date(2023, 11, 2, 17, 25),
type: "folder",
},
{
id: "/Music",
size: 4096,
date: new Date(2023, 11, 1, 14, 45),
type: "folder",
},

{
id: "/Info.txt",
size: 1000,
date: new Date(2023, 10, 30, 6, 13),
type: "file",
},
{
id: "/Code/Datepicker/Year.svelte",
size: 1595,
date: new Date(2023, 11, 7, 15, 23),
type: "file",
},
{
id: "/Pictures/162822515312968813.png",
size: 510885,
date: new Date(2023, 11, 1, 14, 45),
type: "file",
},
];
</script>

<Filemanager
data={rawdata}
//other settings />

Related articles: Loading data