# 修改數據

使用 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-tw/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.
