@filebox/plugin
v1.0.0
Published
Shared FileBox plugin SDK types and helpers
Readme
@filebox/plugin
FileBox 插件 SDK 的共享类型和工具函数,供插件、Web、Desktop 和 App 侧复用。
安装
pnpm add @filebox/plugin使用
import { definePlugin, ok, fileKind } from "@filebox/plugin";
export default definePlugin({
id: "example.preview",
name: "Example Preview",
kind: "preview",
capabilities: ["preview"],
supports: {
ext: ["mp4", "mkv"],
},
});常用能力:
definePlugin(plugin):定义插件并保留类型推导。ok(data)/fail(message):返回统一 API 响应结构。fileKind(file)、extOfFile(file):判断文件类型。mountIframe、mountImage、mountAudio:插件页面常用 DOM 挂载工具。
License
MIT
