Plugin API
English
English
  • Getting Started
    • Introduction
    • Your First Plugin
    • File Structure Overview
    • Plugin Types
      • Window
      • Background Service
      • Format Extension
      • Inspector
    • Debug Plugin
  • Distribution
    • Prepare Plugin
    • Package Plugin
    • Publish Plugin
    • Update Plugin
    • Developer Policies
    • Plugin Icon Template
  • Developer Guide
    • manifest.json Configuration
    • Retrieve Data
    • Modify Data
    • Access Local Files
    • Issue Network Requests
    • Using Node.js Native API
    • Using Third-Party Modules
    • Multilingual (i18n)
    • Frameless Window
  • API Reference
    • event
    • item
    • folder
    • tag
    • tagGroup
    • library
    • window
    • app
    • os
    • screen
    • notification
    • contextMenu
    • dialog
    • clipboard
    • drag
    • shell
    • log
  • Extra Moudle
    • FFmpeg
Powered by GitBook
On this page
  • Example 1: Modify the selected file of the current application
  • Example 2: Modify folder properties
  1. Developer Guide

Modify Data

You can directly modify the results obtained using the Eagle Plugin API method. To save the modified results, just call the save() method of the result object. Here are some simple examples:

Example 1: Modify the selected file of the current application

// Get the currently selected file in the Eagle app
let items = await eagle.item.getSelected();
let item = items[0];

// Modify tags
item.tags = ['tag1', 'tag2'];

// Save changes
await item.save();

Example 2: Modify folder properties

// Get the currently selected folder in the Eagle app
let folder = (await eagle.folder.getSelected())[0];

// Modify properties
folder.name = 'New Folder Name';
folder.description = 'New description...';

// Save changes
await folder.save();

🦄 Best Practice: To ensure data security, use the API-provided save() method for data access and modification, and avoid directly modifying any files under the Eagle resource library.

PreviousRetrieve DataNextAccess Local Files

Last updated 2 years ago