zentao-api 0.6.0 → 0.6.1

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.
package/README.md CHANGED
@@ -160,6 +160,22 @@ result.data?.forEach((product) => console.log(product.name));
160
160
  const raw = await request('product/list', {}, { raw: true });
161
161
  ```
162
162
 
163
+ ### 上传附件
164
+
165
+ Node.js/Bun 可以直接把本地文件路径交给高阶 `request()`;SDK 会根据模块注册表构造 `multipart/form-data`。浏览器中请传 `File` 或 `Blob`,不能传本地路径。
166
+
167
+ ```ts
168
+ const uploaded = await request('file/create', {
169
+ file: '/tmp/zentao-api-upload.txt',
170
+ objectType: 'story',
171
+ objectID: 1,
172
+ });
173
+
174
+ console.log(uploaded.data?.id, uploaded.data?.url);
175
+ ```
176
+
177
+ 单个本地文件或 Blob 默认限制为 50 MiB;可通过单次调用选项 `maxUploadBytes` 调整。
178
+
163
179
  ### 底层 REST 客户端
164
180
 
165
181
  `ZentaoClient` 适合直接调用 API v2 路径: