> For the complete documentation index, see [llms.txt](https://timsixths-plugins.gitbook.io/minigameapi-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://timsixths-plugins.gitbook.io/minigameapi-docs/2.0.0-rc1/basic-features/loaders/loader/file-loader.md).

# File loader

File loader loads data into a list from YAML files.

File loader must extend AbstractFileLoader.

**How to create a loader from a single file?**

```java
public class MyFileLoader extends AbstractFileLoader<UserCoins> {
    
    @Override
    public void load() {
        load("users_coins.yml", "users");
    }
    
    @Override
    public void load(String fileName, String primarySection) {
      loadFile(fileName, primarySection, (key, section) -> 
          this.addObject(section.getObject(key, UserCoins.class)));
    }
}
```

**How to create a loader from a many files?**

```java
public class MyManyFilesLoader extends AbstractFileLoader<UserCoins> {
    
    @Override
    public void load() {
        File file = new File(MiniGame.getInstance().getDataFolder(), "users");

        File[] files = file.listFiles();

        if (files == null) return;

        for (File childFile : files) {
            load(childFile.getAbsolutePath(), "user");
        }
    }
    
    @Override
    public void load(String fileName, String primarySection) {
        File file = new File(fileName);

     loadFile(file , primarySection, (key, section) -> 
          this.addObject(section.getObject(key, UserCoins.class)));
    }
}
```
