๐Ÿ“ฆ LinkLeong / figzima-flow

โ˜… 0 stars โ‘‚ 0 forks ๐Ÿ‘ 0 watching โš–๏ธ Apache License 2.0
๐Ÿ“ฅ Clone https://github.com/LinkLeong/figzima-flow.git
HTTPS git clone https://github.com/LinkLeong/figzima-flow.git
SSH git clone git@github.com:LinkLeong/figzima-flow.git
CLI gh repo clone LinkLeong/figzima-flow
LinkLeong LinkLeong docs: Update README to English a1cd492 6 months ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“„ .gitignore
๐Ÿ“„ code.ts
๐Ÿ“„ LICENSE
๐Ÿ“„ manifest.json
๐Ÿ“„ package-lock.json
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.json
๐Ÿ“„ ui.html
๐Ÿ“„ README.md

FigZima Flow

A Figma plugin for seamless file management with NAS servers, supporting import and export operations between Figma and your local NAS.

Features

  • ๐Ÿ—‚๏ธ File Browser: Browse files and folders on your NAS server
  • ๐Ÿ“ค Export Function: Export Figma designs as PNG, JSON and other formats to NAS
  • ๐Ÿ“ฅ Import Function: Download images, SVG, JSON files from NAS and import to Figma
  • ๐Ÿ”„ Real-time Sync: Support file list refresh and real-time status updates
  • โš ๏ธ Error Handling: Comprehensive error notifications and network status monitoring

Supported File Formats

Export Formats

  • PNG (2x resolution)
  • JSON (page data)

Import Formats

  • Images: PNG, JPG, JPEG, GIF
  • Vector: SVG
  • Data: JSON

Installation and Usage

1. Prerequisites

Make sure you have Node.js and npm installed:

# Check Node.js version
node --version

# Check npm version
npm --version

2. Install Dependencies

Run in the plugin directory:

npm install

3. Build the Code

npm run build

4. Install Plugin in Figma

  • Open Figma
  • Go to Plugins > Development > Import plugin from manifest...
  • Select this plugin folder
  • The plugin will appear in your plugin list

5. Configure NAS Connection

The plugin will prompt you to enter your NAS server information when you first use it:

  • Server Address: Your NAS server URL (e.g., https://your-nas-ip:port)
  • Username: Your NAS username
  • Password: Your NAS password
The plugin will automatically save your login session for future use.

How to Use

Export Files to NAS

  • Select the layers or objects you want to export in Figma
  • Open the FigZima Flow plugin
  • Navigate to the target folder
  • Click the "๐Ÿ“ค Export to NAS" button
  • The plugin will automatically export selected content as PNG and JSON files

Import Files from NAS

  • Open the FigZima Flow plugin
  • Navigate to the folder containing files
  • Double-click the file you want to import
  • The file will be imported to the current Figma page

File Browsing

  • Double-click folder icons to enter subfolders
  • Use path navigation for quick jumps
  • Click "๐Ÿ”„ Refresh" button to update file list
  • Connection status is displayed at the top

API Interface Documentation

File List Interface

GET /v2_1/files/file?path={path}&index=0&size=10000&sfz=true&sort=name&direction=asc
Headers: Authorization: {token}

File Upload Interface

POST /v2_1/files/file/uploadV2
Headers:
  Authorization: {token}
  Content-Type: multipart/form-data
Body: {
  path: "target_path",
  file: "file_data_with_filename:filesize"
}

File Download Interface

GET /v3/file?token={access_token}&files={file_path}&action=download

Development Guide

Project Structure

โ”œโ”€โ”€ code.ts          # Main plugin code
โ”œโ”€โ”€ ui.html          # User interface
โ”œโ”€โ”€ manifest.json    # Plugin configuration
โ”œโ”€โ”€ package.json     # Project configuration
โ””โ”€โ”€ tsconfig.json    # TypeScript configuration

Development Workflow

  • After modifying code, run npm run build to compile
  • Reload the plugin in Figma for testing
  • Check browser console for debugging information

Technical Notes

  • Plugin uses custom base64 encoding/decoding functions as Figma environment doesn't support native btoa/atob
  • Network requests are limited by Figma plugin security policies, allowed domains must be configured in manifest.json
  • File upload uses multipart/form-data format instead of JSON with base64 encoding

Troubleshooting

Connection Failed

  • Check if NAS server address and port are correct
  • Verify access credentials are valid
  • Ensure network connection is stable

Import/Export Failed

  • Confirm file format is supported
  • Check if file size is too large
  • Review console error messages

Build Errors

  • Run npm install to reinstall dependencies
  • Check TypeScript syntax errors
  • Ensure all required type definitions are installed

License

This project is for learning and development purposes.