3
3
# ImageKit.io Node.js SDK
4
4
5
5
[ ![ Node CI] ( https://github.com/imagekit-developer/imagekit-nodejs/workflows/Node%20CI/badge.svg )] ( https://github.com/imagekit-developer/imagekit-nodejs/ )
6
- [ ![ npm version] ( https://img.shields.io/npm/v/imagekit )] ( https://www.npmjs.com/package/imagekit )
6
+ [ ![ npm version] ( https://img.shields.io/npm/v/imagekit )] ( https://www.npmjs.com/package/imagekit )
7
7
[ ![ codecov] ( https://codecov.io/gh/imagekit-developer/imagekit-nodejs/branch/master/graph/badge.svg )] ( https://codecov.io/gh/imagekit-developer/imagekit-nodejs )
8
8
[ ![ Try imagekit on RunKit] ( https://badge.runkitcdn.com/imagekit.svg )] ( https://npm.runkit.com/imagekit )
9
9
[ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( https://opensource.org/licenses/MIT )
@@ -45,6 +45,10 @@ Use the following command to download this module. Use the optional `--save` par
45
45
```
46
46
npm install imagekit --save
47
47
# or
48
+ pnpm install imagekit --save
49
+ # or
50
+ bun install imagekit // if you are using [Bun](https://bun.sh/) compiler
51
+ # or
48
52
yarn add imagekit
49
53
```
50
54
@@ -358,7 +362,7 @@ imagekit.upload({
358
362
else console .log (result);
359
363
});
360
364
361
- // Using Promises
365
+ // Using Promises
362
366
363
367
imagekit .upload ({
364
368
file : < url| base_64| binary> , // required
@@ -412,7 +416,7 @@ imagekit.listFiles({
412
416
});
413
417
414
418
415
- // Using Promises
419
+ // Using Promises
416
420
417
421
imagekit .listFiles ({
418
422
skip : 10 ,
@@ -437,7 +441,7 @@ imagekit.getFileDetails("file_id", function(error, result) {
437
441
});
438
442
439
443
440
- // Using Promises
444
+ // Using Promises
441
445
442
446
imagekit .getFileDetails (" file_id" )
443
447
}).then (response => {
@@ -460,7 +464,7 @@ imagekit.getFileVersions("file_id", function(error, result) {
460
464
});
461
465
462
466
463
- // Using Promises
467
+ // Using Promises
464
468
465
469
imagekit .getFileVersions (" file_id" )
466
470
}).then (response => {
@@ -486,7 +490,7 @@ imagekit.getFileVersionDetails({
486
490
});
487
491
488
492
489
- // Using Promises
493
+ // Using Promises
490
494
491
495
imagekit .getFileVersionDetails ({
492
496
fileId: " file_id" ,
@@ -508,7 +512,7 @@ Note: If `publish` is included in the update options, no other parameters are al
508
512
``` js
509
513
// Using Callback Function
510
514
511
- imagekit .updateFileDetails (" file_id" , {
515
+ imagekit .updateFileDetails (" file_id" , {
512
516
tags : [' image_tag' ],
513
517
customCoordinates : " 10,10,100,100" ,
514
518
extensions: [
@@ -524,7 +528,7 @@ imagekit.updateFileDetails("file_id", {
524
528
});
525
529
526
530
527
- // Using Promises
531
+ // Using Promises
528
532
529
533
imagekit .updateFileDetails (" file_id" , {
530
534
publish: {
@@ -614,7 +618,7 @@ imagekit.deleteFile("file_id", function(error, result) {
614
618
});
615
619
616
620
617
- // Using Promises
621
+ // Using Promises
618
622
619
623
imagekit .deleteFile (" file_id" ).then (response => {
620
624
console .log (response);
@@ -639,7 +643,7 @@ imagekit.deleteFileVersion({
639
643
});
640
644
641
645
642
- // Using Promises
646
+ // Using Promises
643
647
644
648
imagekit .deleteFile ({
645
649
fileId: " file_id" ,
@@ -664,7 +668,7 @@ imagekit.bulkDeleteFiles(["file_id_1", "file_id_2"], function(error, result) {
664
668
});
665
669
666
670
667
- // Using Promises
671
+ // Using Promises
668
672
669
673
imagekit .bulkDeleteFiles ([" file_id_1" , " file_id_2" ]).then (response => {
670
674
console .log (response);
@@ -923,7 +927,7 @@ imagekit.purgeCache("full_url", function(error, result) {
923
927
});
924
928
925
929
926
- // Using Promises
930
+ // Using Promises
927
931
928
932
imagekit .purgeCache (" full_url" ).then (response => {
929
933
console .log (response);
@@ -945,7 +949,7 @@ imagekit.getPurgeCacheStatus("cache_request_id", function(error, result) {
945
949
});
946
950
947
951
948
- // Using Promises
952
+ // Using Promises
949
953
950
954
imagekit .getPurgeCacheStatus (" cache_request_id" ).then (response => {
951
955
console .log (response);
@@ -966,7 +970,7 @@ imagekit.getFileMetadata("file_id", function(error, result) {
966
970
});
967
971
968
972
969
- // Using Promises
973
+ // Using Promises
970
974
imagekit .getFileMetadata (" file_id" )
971
975
}).then (response => {
972
976
console .log (response);
@@ -985,7 +989,7 @@ imagekit.getFileMetadata("https://ik.imagekit.io/your_imagekit_id/sample.jpg", f
985
989
});
986
990
987
991
988
- // Using Promises
992
+ // Using Promises
989
993
imagekit .getFileMetadata (" https://ik.imagekit.io/your_imagekit_id/sample.jpg" )
990
994
}).then (response => {
991
995
console .log (response);
@@ -1010,15 +1014,15 @@ imagekit.createCustomMetadataField(
1010
1014
minValue: 1000 ,
1011
1015
maxValue: 3000
1012
1016
}
1013
- },
1017
+ },
1014
1018
function (error , result ) {
1015
1019
if (error) console .log (error);
1016
1020
else console .log (result);
1017
1021
}
1018
1022
);
1019
1023
1020
1024
1021
- // Using Promises
1025
+ // Using Promises
1022
1026
1023
1027
imagekit .createCustomMetadataField (
1024
1028
{
@@ -1047,15 +1051,15 @@ Get the list of all custom metadata fields as per the [API documentation here](h
1047
1051
imagekit .getCustomMetadataFields (
1048
1052
{
1049
1053
includeDeleted: false // optional
1050
- },
1054
+ },
1051
1055
function (error , result ) {
1052
1056
if (error) console .log (error);
1053
1057
else console .log (result);
1054
1058
}
1055
1059
);
1056
1060
1057
1061
1058
- // Using Promises
1062
+ // Using Promises
1059
1063
1060
1064
imagekit .getCustomMetadataFields (
1061
1065
{
@@ -1082,15 +1086,15 @@ imagekit.updateCustomMetadataField(
1082
1086
minValue: 500 ,
1083
1087
maxValue: 2500
1084
1088
}
1085
- },
1089
+ },
1086
1090
function (error , result ) {
1087
1091
if (error) console .log (error);
1088
1092
else console .log (result);
1089
1093
}
1090
1094
);
1091
1095
1092
1096
1093
- // Using Promises
1097
+ // Using Promises
1094
1098
1095
1099
imagekit .updateCustomMetadataField (
1096
1100
" field_id" ,
@@ -1099,7 +1103,7 @@ imagekit.updateCustomMetadataField(
1099
1103
minValue: 500 ,
1100
1104
maxValue: 2500
1101
1105
}
1102
- },
1106
+ },
1103
1107
).then (response => {
1104
1108
console .log (response);
1105
1109
}).catch (error => {
@@ -1123,7 +1127,7 @@ imagekit.deleteCustomMetadataField(
1123
1127
);
1124
1128
1125
1129
1126
- // Using Promises
1130
+ // Using Promises
1127
1131
1128
1132
imagekit .deleteCustomMetadataField (
1129
1133
" field_id"
0 commit comments