txb-cloudinary-image-uploader 1.0.3 → 1.0.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +20 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "txb-cloudinary-image-uploader",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A lightweight, promise-based utility to handle seamless image uploads to Cloudinary directly from the browser.",
5
5
  "license": "ISC",
6
6
  "author": "Saleh Ahmed Mahin",
package/readme.md CHANGED
@@ -20,3 +20,23 @@ Before using this function, gather the following details from your [Cloudinary D
20
20
  1. **Cloud Name**: Your unique Cloudinary identifier.
21
21
  2. **Upload Preset**: Create an **'Unsigned'** upload preset in Cloudinary Settings (Settings > Upload).
22
22
  3. **API URL**: Typically formatted as: `https://api.cloudinary.com/v1_1/YOUR_CLOUD_NAME/image/upload`
23
+
24
+ ## Simple implementation
25
+ ```import uploadToCloudinary from 'txb-cloudinary-image-uploader';
26
+
27
+ const handleUpload = async (file: File) => {
28
+ try {
29
+ // Call the function with 3 simple parameters
30
+ const { url, public_id } = await uploadToCloudinary(
31
+ file,
32
+ "your_upload_preset", // cloudinary upload preset
33
+ "your_cloud_name" // cloudinary cloud name
34
+ );
35
+
36
+ console.log("Uploaded Image URL:", url);
37
+ console.log("Cloudinary Public ID:", public_id);
38
+ } catch (error) {
39
+ console.error("Upload failed:", error);
40
+ }
41
+ };
42
+ ```