You can use node.js and tar-to-zip for this purpose. All you have to do is:
Install node.js with nvm if you don't have one.
And then install tar-to-zip with:
npm i tar-to-zip -g
And use it with:
tarzip *.tar.gz
You can also convert .tar.gz files to .zip programmatically. You must install async and tar-to-zip locally:
npm i async tar-to-zip
And then create converter.js with the content:
#!/usr/bin/env node 'use strict'; const fs = require('fs'); const tarToZip = require('tar-to-zip'); const eachSeries = require('async/eachSeries'); const names = process.argv.slice(2); eachSeries(names, convert, exitIfError); function convert(name, done) { const {stdout} = process; const onProgress = (n) => { stdout.write(`\r${n}%: ${name}`); }; const onFinish = (e) => { stdout.write('\n'); done(); }; const nameZip = name.replace(/\.tar\.gz$/, '.zip'); const zip = fs.createWriteStream(nameZip) .on('error', (error) => { exitIfError(error); fs.unlinkSync(zipPath); }); const progress = true; tarToZip(name, {progress}) .on('progress', onProgress) .on('error', exitIfError) .getStream() .pipe(zip) .on('finish', onFinish); } function exitIfError(error) { if (!error) return; console.error(error.message); process.exit(1); }
source share