Socket
Socket
Sign inDemoInstall

asar

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asar

Creating Electron app packages


Version published
Weekly downloads
250K
increased by5.56%
Maintainers
2
Weekly downloads
 
Created

What is asar?

The 'asar' npm package is used to create and manage ASAR (Atom Shell Archive) files, which are essentially archives used by Electron applications to package their resources. ASAR files are similar to tar files but are optimized for use with Electron.

What are asar's main functionalities?

Creating an ASAR archive

This feature allows you to create an ASAR archive from a source directory. The code sample demonstrates how to use the 'createPackage' method to create an ASAR archive from the contents of 'path/to/source' and save it to 'path/to/output.asar'.

const asar = require('asar');

asar.createPackage('path/to/source', 'path/to/output.asar').then(() => {
  console.log('ASAR archive created successfully');
}).catch(err => {
  console.error('Error creating ASAR archive:', err);
});

Extracting an ASAR archive

This feature allows you to extract the contents of an ASAR archive to a specified directory. The code sample demonstrates how to use the 'extractAll' method to extract the contents of 'path/to/archive.asar' to 'path/to/destination'.

const asar = require('asar');

asar.extractAll('path/to/archive.asar', 'path/to/destination').then(() => {
  console.log('ASAR archive extracted successfully');
}).catch(err => {
  console.error('Error extracting ASAR archive:', err);
});

Listing files in an ASAR archive

This feature allows you to list the files contained within an ASAR archive. The code sample demonstrates how to use the 'listPackage' method to list the files in 'path/to/archive.asar'.

const asar = require('asar');

asar.listPackage('path/to/archive.asar').then(files => {
  console.log('Files in ASAR archive:', files);
}).catch(err => {
  console.error('Error listing files in ASAR archive:', err);
});

Other packages similar to asar

FAQs

Package last updated on 13 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc