Skip to content

Commit 1360a52

Browse files
committed
chore: add sdk docs and examples
1 parent 79fe3cb commit 1360a52

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

docs/sdks/tigris/client-uploads.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ import { upload } from "@tigrisdata/storage/client";
3636
| url | Yes | The URL to backend endpoint where Storage SDK is running on server. |
3737
| access | No | The access level for the object. Possible values are `public` and `private`. |
3838
| addRandomSuffix | No | Whether to add a random suffix to the object name. Default is `false`. |
39+
| concurrency | No | Maximum number of concurrent part uploads for multipart uploads. Default is `4`. |
3940
| contentType | No | The content type of the object. |
4041
| contentDisposition | No | The content disposition of the object. Possible values are `inline` and `attachment`. Default is `inline`. Use `attachment` for downloadable files. |
4142
| multipart | No | Pass `multipart: true` when uploading large objects. It will split the object into multiple parts and upload them in parallel. |
4243
| partSize | No | The size of the part to upload. Default is `5 * 1024 * 1024` (5 MiB). |
4344
| onUploadProgress | No | Callback to track upload progress: `onUploadProgress({loaded: number, total: number, percentage: number})`. |
44-
| config | No | A configuration object to override the [default configuration](/docs/sdks/tigris/using-sdk#authentication). |
4545

4646
In case of successful upload, the `data` property will be set to the upload and
4747
contains the following properties:

docs/sdks/tigris/examples.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,36 @@ export default function ClientUpload() {
225225
</TabItem>
226226

227227
</Tabs>
228+
229+
## React Package
230+
231+
Alternatively, you can use the `Uploader` component from the `@tigrisdata/react`
232+
package to render a file uploader component that integrates with the Tigris
233+
Storage SDK.
234+
235+
```tsx
236+
import { Uploader } from "@tigrisdata/react";
237+
import "@tigrisdata/react/styles.css"; // Optional: import default styles
238+
239+
export default function ClientUpload() {
240+
return (
241+
<div className="bg-white shadow rounded-lg p-6 mb-6">
242+
<h2 className="text-lg font-medium text-gray-900 mb-2">Client Uploads</h2>
243+
<Uploader
244+
className="mt-4 tigris-uploader"
245+
accept="image/*"
246+
multiple={true}
247+
multipart={true}
248+
concurrency={3}
249+
url="/api/upload"
250+
onUploadComplete={(file, response) => {
251+
console.log("Uploaded:", response.url);
252+
}}
253+
onUploadError={(file, error) => {
254+
console.error("Failed:", error.message);
255+
}}
256+
/>
257+
</div>
258+
);
259+
}
260+
```

0 commit comments

Comments
 (0)