I am currently working on a solution that requires checking the resource type. In other words: is it a directory or a file and its extension.
I tried using API method /dag/get?arg=hash to retrieve the information about a particular resource, although it works great for directories as I can understand what this directory contains and see all extensions of all files under it, this approach does not quite work for single files because it requires to download the entire file (that is encoded inside “data” field) and only after that I see the JSON response containing no information but the data and an empty links array.
My question: is there a way to check what’s the type and if possible an extension of the resource. Eventually I am looking forward to create the following pipeline:
- Input the hash
- Get the information about the hash: type (file/directory) and if it’s a single file - its extension
In case of a file it’s crucial to avoid downloading the whole file as it could be a large file and it will slow down the aggregation process by a lot.
Any help is appreciated