imagekit-developer / imagekit-nodejs

Node.js SDK for ImageKit.io API.
https://imagekit.io
Other
84 stars 32 forks source link

Can't retrieve folder metadata. #84

Closed idavidgeo closed 11 months ago

idavidgeo commented 11 months ago

I've assigned a custom metadata item to a folder (folder2 in this case). But I can't figure out a way to retrieve it.

imagekit.getFileMetadata('folder/folder2') doesn't work.

imagekitio commented 11 months ago

You actually need to fetch the media asset details. Use this method instead imagekit.getFileDetails

// Using Callback Function

imagekit.getFileDetails("file_id", function(error, result) {
    if(error) console.log(error);
    else console.log(result);
});

// Using Promises 

imagekit.getFileDetails("file_id")
}).then(response => {
    console.log(response);
}).catch(error => {
    console.log(error);
});
idavidgeo commented 10 months ago

You actually need to fetch the media asset details. Use this method instead imagekit.getFileDetails

// Using Callback Function

imagekit.getFileDetails("file_id", function(error, result) {
    if(error) console.log(error);
    else console.log(result);
});

// Using Promises 

imagekit.getFileDetails("file_id")
}).then(response => {
    console.log(response);
}).catch(error => {
    console.log(error);
});

Right, but I want the folder metadata, not the file. I've set metadata variables for the folder via the web dashboard and want to retrieve them via API.

idavidgeo commented 10 months ago

@imagekitio any idea?