How to use 7zip-bin - 6 common examples

To help you get started, we’ve selected a few 7zip-bin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mattermost / desktop / scripts / manipulate_windows_zip.js View on Github external
// Copyright (c) 2015-2016 Yuya Ochiai
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
'use strict';

const spawnSync = require('child_process').spawnSync;

const path7za = require('7zip-bin').path7za;

const pkg = require('../src/package.json');
const appVersion = pkg.version;
const productName = pkg.productName;

function renameInZip(zipPath, oldName, newName) {
  const result = spawnSync(path7za, ['rn', zipPath, oldName, newName]);
  return result.status === 0;
}

console.log('Manipulating 64-bit zip...');
if (!renameInZip(`release/${productName}-${appVersion}-win.zip`, 'win-unpacked', `${productName}-${appVersion}-win64`)) {
  throw new Error('7za returned non-zero exit code for 64-bit zip');
}

console.log('Manipulating 32-bit zip...');
github poooi / poi / build / utils.es View on Github external
import fs from 'fs-extra'
import path from 'path-extra'
import { log } from '../lib/utils'
import child_process from 'child_process'
import Seven from 'node-7z'
import sevenBin from '7zip-bin'

const pathTo7zip = sevenBin.path7za

const { ROOT } = global
export const NPM_EXEC_PATH = path.join(ROOT, 'node_modules', 'npm', 'bin', 'npm-cli.js')
export const PLUGIN_JSON_PATH = path.join(ROOT, 'assets', 'data', 'plugin.json')

export const compress7z = async (files, archive, options) => {
  options = {
    ...options,
    $bin: pathTo7zip,
  }
  try {
    await fs.remove(archive)
  } catch (e) {
    console.error(e.stack)
  }
  await Seven.add(archive, files, options)
github ollm / OpenComic / scripts / file-compressed.js View on Github external
callback({error: ERROR_UNZIPPING_THE_FILE, detail: error.message});
					}
				}
				catch(error)
				{
					console.error(error);
					callback({error: ERROR_UNZIPPING_THE_FILE, detail: error.message});
				}

			});

		}
		else if(inArray(fileExtension(path), compressedExtensions['7z']))
		{
			if(un7z === false) un7z = require('node-7z');
			if(bin7z === false) bin7z = asarToAsarUnpacked(require('7zip-bin').path7za);

			un7z.extractFull(path, p.join(tempFolder, shaExt), {$progress: true, p: false/*'myPassword'*/, $bin: bin7z}).on('progress', function(progress) {

				setProgress(progress.percent / 100, contentRightZindex);

			}).on('end', function (data) {

				try
				{
					if(fs.existsSync(p.join(tempFolder, shaExt))) fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha));

	 				var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath});

					if(!json || json.mtime != mtime)
						cache.writeFile(cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){});
github adopted-ember-addons / ember-electron / lib / utils / ship-mac.js View on Github external
const fs = require('fs-extra')
const path = require('path')
const childProcess = require('child_process')
const path7za = require('7zip-bin').path7za

const PromiseExt = require('ember-cli/lib/ext/promise')

module.exports = function shipMac (pkg, options) {
  const mkdir = PromiseExt.denodeify(fs.mkdirs)

  return mkdir(path.join('electron-builds', 'installers'))
    .finally(() => createZip(pkg, options))
}

function createZip (pkg, options) {
  const ee = pkg['ember-electron']
  const access = PromiseExt.denodeify(fs.access)
  const unlink = PromiseExt.denodeify(fs.unlink)

  const name = options.name || ee.name || pkg.name
github dreamnettech / dreamtime / src / electron / src / modules / tools / fs.js View on Github external
export function extractSeven(path, destinationPath) {
  const def = deferred()

  let pathTo7zip

  if (is.development) {
    pathTo7zip = sevenBin.path7za
  } else {
    const binName = platform({
      macos: '7za',
      linux: '7za',
      windows: '7za.exe',
    })

    pathTo7zip = getAppResourcesPath('7zip-bin', binName)
  }

  const seven = extractFull(path, destinationPath, {
    $bin: pathTo7zip,
    recursive: true,
  })

  seven.on('end', () => {
github pursuit-gg / pursuit-client / scripts / install-plugin.js View on Github external
async function runScript() {
  const zipExe = zip.path7za;
  const nodeObsPath = path.join(__dirname, '..', 'node_modules', '@streamlabs', 'obs-studio-node', 'libobs');

  const obsFrameCaptureFilterDownloadUrl = `https://github.com/pursuit-gg/obs-frame-capture-filter/releases/download/v${OBS_FRAME_CAPTURE_FILTER_VERSION}/obs-frame-capture-filter-v${OBS_FRAME_CAPTURE_FILTER_VERSION}.zip`;
  const obsFrameCaptureFilterArchivePath = path.join(os.tmpdir(), `obs-frame-capture-filter-v${OBS_FRAME_CAPTURE_FILTER_VERSION}.zip`);
  const obsFrameCaptureFilterArchive = fs.createWriteStream(obsFrameCaptureFilterArchivePath);
  const obsFrameCaptureFilterArchiveFinishPromise = new Promise(resolve => obsFrameCaptureFilterArchive.on('finish', resolve));

  sh.echo(`Downloading obs-frame-capture-filter version ${OBS_FRAME_CAPTURE_FILTER_VERSION}...`);
  https.get(obsFrameCaptureFilterDownloadUrl, redirectResponse => (
    https.get(redirectResponse.headers.location, response => response.pipe(obsFrameCaptureFilterArchive))
  ));
  await obsFrameCaptureFilterArchiveFinishPromise;

  sh.echo('Extracting obs-frame-capture-filter archive...');
  const result = sh.exec(`"${zipExe}" x "${obsFrameCaptureFilterArchivePath}" -o"${nodeObsPath}" -aoa`);

7zip-bin

7-Zip precompiled binaries

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular 7zip-bin functions