how to rename zip file nodejs
var AdmZip = require('adm-zip');
//create a zip object to hold the new zip files
var newZip = new AdmZip();
// reading archives
var zip = new AdmZip('somePath/download.zip');
var zipEntries = zip.getEntries(); // an array of ZipEntry records
zipEntries.forEach(function(zipEntry) {
var fileName = zipEntry.entryName;
var fileContent = zip.readAsText(fileName)
//Here remove the top level directory
var newFileName = fileName.substring(fileName.indexOf("/") + 1);
newZip.addFile(newFileName, fileContent, '', 0644 << 16);
});
newZip.writeZip('somePath/upload.zip'); //write the new zip
Also in JavaScript:
- multiple conditions for JavaScript .includes() method
- generate 50 random numbers between 1 and 500 in javascript
- copy to clipboard javascript
- react select with custom option
- shadow using react native
- js when key is pressed
- public static void main(dsjjsdds, jdnjd, jsndjsd, isjdjsd, sjdijs, skjdks_+) __ osakd___ +++
- prime factorization javascript
- what is ... in javascript
- profile Image Picture Preview
- base64 decode javascript
- jQuery element with multiple classes
- angular back button
- jquery add class
- javascript check if key exists in object
- live search using fetch api
- delete cookies by domain javascript
- error: Error: Unable to resolve module `crypto` from `node_modules\crypto-js\core.js`: crypto could not be found within the project.
- ajax larave;
- model mongoose
- hide automatically show and hide javascript
- javascript to uppercase
- how to convert array to string json
- calculate log in javascript