Quering uploaded file attached to a record in lifecycle hook

System Information
  • Strapi Version: 3.6.8
  • Database: mongodb
  • Node Version: 14

How to query file by id attached to a newly created record in lifecycle hook?

In beforeCreate lifecycle hook where data is visible, console.log shows that file is already uploaded and id of the file is added to records attribute: strapi | gpx: '61488f98c33c67000f64a4f0',. How can I query that file object to run a file conversion (gpx to geoJSON) using local path to gpx file.

For documentation purposes:

const { fetch } = strapi.plugins.upload.services["upload"];
const dbFile = await fetch({ id: "5fc94314f0bf8afd27d5bad9" });