I am working on a project were i need to extract every file (xml) in an zip to an array of strings. I am going parse trough the array later on. I have tried so many imports like jszip, yauzl, unzipper, adm-zip, node-stream-zip and so on... But i cant manage to do it. Can any of you guys help me?
const conf = {
headers: {
"Content-Type": "application/zip",
},
auth: {
username: "username",
password: "password",
},
};
try {
const res = await axios.get("url", conf);
zipFiles = []
<!--- Code to push files in zip to array .....--->
console.log(zipFiles)
/*
Return something like:
[
"<?xml versi...",
"<?xml versi...",
"<?xml versi..."
]
*/
} catch (e) {
console.log(e);
}
This link kinda answered the problem: Download zip with axios and unzip with adm-zip in memory (electron app)
But i get Error: Invalid filename
since AdmZip needs a Buffer while the zip is a utf8 string