@teddyzhu/clipboard 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +19 -9
  2. package/index.js +2 -0
  3. package/package.json +8 -7
package/index.d.ts CHANGED
@@ -59,18 +59,22 @@ export declare class ClipboardManager {
59
59
  setRichText(text: string): void
60
60
  /** 获取剪贴板中的图片数据(以 base64 编码返回) */
61
61
  getImageBase64(): string
62
- /** 获取剪贴板中的图片详细信息(包含宽度、高度、大小和 base64 数据) */
62
+ /** 获取剪贴板中的图片详细信息(包含宽度、高度、大小和原始数据) */
63
63
  getImageData(): ImageData
64
64
  /** 从 base64 编码的图片数据设置剪贴板图片 */
65
65
  setImageBase64(base64Data: string): void
66
+ /** 从原始字节数据设置剪贴板图片 */
67
+ setImageRaw(imageData: Buffer): void
68
+ /** 获取剪贴板中的图片原始数据(Buffer) */
69
+ getImageRaw(): Buffer
66
70
  /** 获取剪贴板中的文件列表 */
67
71
  getFiles(): Array<string>
68
72
  /** 设置剪贴板中的文件列表 */
69
73
  setFiles(files: Array<string>): void
70
74
  /** 设置剪贴板中的自定义格式数据 */
71
- setBuffer(format: string, buffer: Array<number>): void
75
+ setBuffer(format: string, buffer: Buffer): void
72
76
  /** 获取剪贴板中的自定义格式数据 */
73
- getBuffer(format: string): Array<number>
77
+ getBuffer(format: string): Buffer
74
78
  /** 设置剪贴板中的复合内容(可同时设置多种格式) */
75
79
  setContents(contents: ClipboardData): void
76
80
  /** 检查剪贴板是否包含指定格式的内容 */
@@ -85,7 +89,7 @@ export declare class ClipboardManager {
85
89
  setTextAsync(text: string): Promise<void>
86
90
  /** 异步获取剪贴板图片数据(以 base64 编码返回) */
87
91
  getImageBase64Async(): Promise<string>
88
- /** 异步获取剪贴板图片详细信息(包含宽度、高度、大小和 base64 数据) */
92
+ /** 异步获取剪贴板图片详细信息(包含宽度、高度、大小和原始数据) */
89
93
  getImageDataAsync(): Promise<ImageData>
90
94
  }
91
95
 
@@ -109,7 +113,7 @@ export interface ClipboardData {
109
113
  }
110
114
 
111
115
  /** 快速获取剪贴板自定义格式数据 */
112
- export declare function getClipboardBuffer(format: string): Array<number>
116
+ export declare function getClipboardBuffer(format: string): Buffer
113
117
 
114
118
  /** 快速获取剪贴板文件列表 */
115
119
  export declare function getClipboardFiles(): Array<string>
@@ -120,9 +124,12 @@ export declare function getClipboardHtml(): string
120
124
  /** 快速获取剪贴板图片(base64 编码) */
121
125
  export declare function getClipboardImage(): string
122
126
 
123
- /** 快速获取剪贴板图片详细信息(包含宽度、高度、大小和 base64 数据) */
127
+ /** 快速获取剪贴板图片详细信息(包含宽度、高度、大小和原始数据) */
124
128
  export declare function getClipboardImageData(): ImageData
125
129
 
130
+ /** 快速获取剪贴板图片原始数据(Buffer) */
131
+ export declare function getClipboardImageRaw(): Buffer
132
+
126
133
  /** 快速获取剪贴板文本内容 */
127
134
  export declare function getClipboardText(): string
128
135
 
@@ -137,8 +144,8 @@ export interface ImageData {
137
144
  height: number
138
145
  /** 图片数据大小(字节) */
139
146
  size: number
140
- /** 图片数据(base64 编码) */
141
- base64Data: string
147
+ /** 图片原始数据(Buffer) */
148
+ data: Buffer
142
149
  }
143
150
 
144
151
  /**
@@ -149,7 +156,7 @@ export interface ImageData {
149
156
  export declare function isWaylandClipboardAvailable(): boolean
150
157
 
151
158
  /** 快速设置剪贴板自定义格式数据 */
152
- export declare function setClipboardBuffer(format: string, buffer: Array<number>): void
159
+ export declare function setClipboardBuffer(format: string, buffer: Buffer): void
153
160
 
154
161
  /** 快速设置剪贴板复合内容(可同时设置多种格式) */
155
162
  export declare function setClipboardContents(contents: ClipboardData): void
@@ -163,5 +170,8 @@ export declare function setClipboardHtml(html: string): void
163
170
  /** 快速设置剪贴板图片(从 base64 编码) */
164
171
  export declare function setClipboardImage(base64Data: string): void
165
172
 
173
+ /** 快速设置剪贴板图片(从原始字节数据) */
174
+ export declare function setClipboardImageRaw(imageData: Buffer): void
175
+
166
176
  /** 快速设置剪贴板文本内容 */
167
177
  export declare function setClipboardText(text: string): void
package/index.js CHANGED
@@ -401,6 +401,7 @@ module.exports.getClipboardFiles = nativeBinding.getClipboardFiles
401
401
  module.exports.getClipboardHtml = nativeBinding.getClipboardHtml
402
402
  module.exports.getClipboardImage = nativeBinding.getClipboardImage
403
403
  module.exports.getClipboardImageData = nativeBinding.getClipboardImageData
404
+ module.exports.getClipboardImageRaw = nativeBinding.getClipboardImageRaw
404
405
  module.exports.getClipboardText = nativeBinding.getClipboardText
405
406
  module.exports.getFullClipboardData = nativeBinding.getFullClipboardData
406
407
  module.exports.isWaylandClipboardAvailable = nativeBinding.isWaylandClipboardAvailable
@@ -409,4 +410,5 @@ module.exports.setClipboardContents = nativeBinding.setClipboardContents
409
410
  module.exports.setClipboardFiles = nativeBinding.setClipboardFiles
410
411
  module.exports.setClipboardHtml = nativeBinding.setClipboardHtml
411
412
  module.exports.setClipboardImage = nativeBinding.setClipboardImage
413
+ module.exports.setClipboardImageRaw = nativeBinding.setClipboardImageRaw
412
414
  module.exports.setClipboardText = nativeBinding.setClipboardText
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teddyzhu/clipboard",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "it's a node package with napi-rs wrapper clipboard-rs",
5
5
  "main": "index.js",
6
6
  "repository": "git@github.com:Teddy-Zhu/node-clipboard-rs.git",
@@ -57,6 +57,7 @@
57
57
  "@oxc-node/core": "^0.0.29",
58
58
  "@taplo/cli": "^0.7.0",
59
59
  "@tybys/wasm-util": "^0.10.0",
60
+ "@types/node": "^24.1.0",
60
61
  "ava": "^6.4.0",
61
62
  "chalk": "^5.4.1",
62
63
  "husky": "^9.1.7",
@@ -101,11 +102,11 @@
101
102
  },
102
103
  "packageManager": "yarn@4.9.2",
103
104
  "optionalDependencies": {
104
- "@teddyzhu/clipboard-win32-x64-msvc": "0.0.4",
105
- "@teddyzhu/clipboard-darwin-x64": "0.0.4",
106
- "@teddyzhu/clipboard-linux-x64-gnu": "0.0.4",
107
- "@teddyzhu/clipboard-linux-arm64-gnu": "0.0.4",
108
- "@teddyzhu/clipboard-darwin-arm64": "0.0.4",
109
- "@teddyzhu/clipboard-win32-arm64-msvc": "0.0.4"
105
+ "@teddyzhu/clipboard-win32-x64-msvc": "0.0.5",
106
+ "@teddyzhu/clipboard-darwin-x64": "0.0.5",
107
+ "@teddyzhu/clipboard-linux-x64-gnu": "0.0.5",
108
+ "@teddyzhu/clipboard-linux-arm64-gnu": "0.0.5",
109
+ "@teddyzhu/clipboard-darwin-arm64": "0.0.5",
110
+ "@teddyzhu/clipboard-win32-arm64-msvc": "0.0.5"
110
111
  }
111
112
  }