# 修改数据

使用 Eagle Plugin API 方法获取的结果皆可以直接进行修改，如果想要保存修改的结果，只需调用结果对象的 `save()` 方法即可完成，这里有一些简单的示例：\\

## **示例一：修改当前应用选中的文件**

```javascript
// 取得 Eagle 应用当前被选中的文件
let items = await eagle.item.getSelected();
let item = items[0];

// 修改标签
item.tags = ['tag1', 'tag2'];

// 保存修改
await item.save();

```

## **示例二：修改文件夹属性**

```javascript
// 取得 Eagle 应用当前被选中的文件夹
let folder = (await eagle.folder.getSelected())[0];

// 修改属性
folder.name = 'New Folder Name';
folder.description = 'New description...';

// 保存修改
await folder.save();
```

{% hint style="success" %}
**🦄 最佳实践：** 为了确保数据安全性，请使用 API 提供的 `save()` 方法进行数据的存取与修改，应避免直接修改 Eagle 资源库底下的任意文件。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.eagle.cool/plugin-api/zh-cn/tutorial/modify-eagle-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
