Download attachments field wise from List view of any DocType

Is there any way to download attachments field wise from List view of any DocType?

Possible, you can download all attachments but not according to the field wise. it’s challenging. You have to write the code in listview.

onload: function(doclist){"Export as zip"), () => {
		let docnames = doclist.get_checked_items(true);
		if (docnames.length) {
			const fieldMap = {
				'CV': 'cv',
				'Salary Slip': 'salary_slip',
				'Photograph': 'photo',
				'Signature': 'sign'
			const fieldOptions = Object.keys(fieldMap);
				{'fieldname': 'field_to_export', 'fieldtype': 'Select', 'label': 'Field data to export', 'options': fieldOptions, 'reqd': 1, 'default': fieldOptions[0]}
			], (values) => {
				const selectedFieldname = fieldMap[values.field_to_export];
				open_url_post("/api/method/doctype.zip_files", {
					files: JSON.stringify(docnames),
					fieldname: selectedFieldname
			}, __("Select Field"));

from frappe.core.doctype.file.file import File

def zip_files(files: str, fieldname: str = "resume"):
	docs = []
	files = frappe.parse_json(files)
	for docname in files:
		doc = frappe.get_doc(DocType, docname)
		if doc.get(fieldname):
			file = frappe.db.get_value("File", {"file_url": doc.get(fieldname)}, "name")
			if file:
	frappe.response["filename"] = ""
	frappe.response["filecontent"] = File.zip_files(docs)
	frappe.response["type"] = "download"

I’m currently passing field names statically.
Does anyone have any idea how to dynamically retrieve field labels and names from the list view of any doctype from the docnames?