# Is it possible to get the artifact version in standalone mode?

**URL:** <https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901>\
**Category:** General Discussions\
**Tags:** yocto, sumo, nxp, standalone\
**Created:** [August 8, 2019, 10:57am UTC](https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901 "2019-08-08T10:57:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajithpv](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ajithpv/32/728_2.png) [@ajithpv](https://hub.mender.io/u/ajithpv)\
**Post date:** [August 8, 2019, 10:57am UTC](https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901/1 "2019-08-08T10:57:26Z")

</div>

Hi,

AFAIK, currently, the _mender server_ is checking the artifact version and deciding whether the artifact need to be installed (by checking whether it is already installed on the target platform). Please correct me if I’m wrong.

Since I’m using the mender in standalone mode, I would like to get this feature in the mender client.  
Could you please let me know whether this feature can be checked from mender client? Is it possible to get the mender artifact version before downloading/streaming the artifact to the partition?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [August 8, 2019, 11:18am UTC](https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901/2 "2019-08-08T11:18:58Z")

</div>

It’s not possible. The closest thing would be to compile mender-artifact  
and use it’s “read” command with some shell parsing to figure out the  
name of the artifact.

---

<div class="post-metadata">

**Author:** ![ajithpv](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ajithpv/32/728_2.png) [@ajithpv](https://hub.mender.io/u/ajithpv)\
**Post date:** [August 8, 2019, 11:31am UTC](https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901/3 "2019-08-08T11:31:13Z")

</div>

May I know what mender server doing to get the artifact name? Whether server make use of the same _read_ command?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [August 8, 2019, 11:47am UTC](https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901/4 "2019-08-08T11:47:32Z")

</div>

It uses the mender-artifact parsing library, in particular it calls the  
areader.ReadArtifactHeaders() function. The deployment service is using  
the same library as the mender client.

---

<div class="post-metadata">

**Author:** ![andersm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/andersm/32/797_2.png) [@andersm](https://hub.mender.io/u/andersm)\
**Post date:** [August 15, 2019, 7:24am UTC](https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901/5 "2019-08-15T07:24:54Z")

</div>

A colleague pointed out that since the artifacts are tar archives, you can extract the data yourself. Eg.  
`$ tar xf artifact.mender header.tar.gz -O | tar xz header-info` extracts the JSON file containing the artifact name.

Since the artifact format specifies that the metadata is stored near the beginning of the archive, you can fetch only the start of the file, which saves both time and bandwidth.

---

<div class="post-metadata">

**Author:** ![ajithpv](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/ajithpv/32/728_2.png) [@ajithpv](https://hub.mender.io/u/ajithpv)\
**Post date:** [August 19, 2019, 5:35am UTC](https://hub.mender.io/t/is-it-possible-to-get-the-artifact-version-in-standalone-mode/901/6 "2019-08-19T05:35:14Z")

</div>

Thank you very much @andersm for this awesome tip 👍
