Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asar

Package Overview
Dependencies
Maintainers
6
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asar - npm Package Compare versions

Comparing version 0.10.0 to 0.11.0

42

lib/asar.js

@@ -46,2 +46,3 @@ (function() {

/*

@@ -55,7 +56,6 @@ createPackageFromFiles - Create an asar-archive from a list of filenames

callback: The callback function. Accepts (err).
*/
*/
module.exports.createPackageFromFiles = function(src, dest, filenames, metadata, options, callback) {
var dirName, file, filename, filenamesSorted, files, filesystem, missing, ordering, orderingFiles, pathComponent, pathComponents, shouldUnpack, stat, str, total, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m;
var dirName, file, filename, filenamesSorted, files, filesystem, i, j, k, l, len, len1, len2, len3, len4, m, missing, ordering, orderingFiles, pathComponent, pathComponents, shouldUnpack, stat, str, total, type;
if (metadata == null) {

@@ -78,8 +78,8 @@ metadata = {};

ordering = [];
for (_i = 0, _len = orderingFiles.length; _i < _len; _i++) {
file = orderingFiles[_i];
for (i = 0, len = orderingFiles.length; i < len; i++) {
file = orderingFiles[i];
pathComponents = file.split(path.sep);
str = src;
for (_j = 0, _len1 = pathComponents.length; _j < _len1; _j++) {
pathComponent = pathComponents[_j];
for (j = 0, len1 = pathComponents.length; j < len1; j++) {
pathComponent = pathComponents[j];
str = path.join(str, pathComponent);

@@ -92,4 +92,4 @@ ordering.push(str);

total = filenames.length;
for (_k = 0, _len2 = ordering.length; _k < _len2; _k++) {
file = ordering[_k];
for (k = 0, len2 = ordering.length; k < len2; k++) {
file = ordering[k];
if (filenamesSorted.indexOf(file) === -1 && filenames.indexOf(file) !== -1) {

@@ -99,4 +99,4 @@ filenamesSorted.push(file);

}
for (_l = 0, _len3 = filenames.length; _l < _len3; _l++) {
file = filenames[_l];
for (l = 0, len3 = filenames.length; l < len3; l++) {
file = filenames[l];
if (filenamesSorted.indexOf(file) === -1) {

@@ -111,4 +111,4 @@ filenamesSorted.push(file);

}
for (_m = 0, _len4 = filenamesSorted.length; _m < _len4; _m++) {
filename = filenamesSorted[_m];
for (m = 0, len4 = filenamesSorted.length; m < len4; m++) {
filename = filenamesSorted[m];
file = metadata[filename];

@@ -191,3 +191,3 @@ if (!file) {

module.exports.extractAll = function(archive, dest) {
var content, destFilename, error, file, filename, filenames, filesystem, followLinks, linkDestPath, linkSrcPath, linkTo, relativePath, _i, _len, _results;
var content, destFilename, error, file, filename, filenames, filesystem, followLinks, i, len, linkDestPath, linkSrcPath, linkTo, relativePath, results;
filesystem = disk.readFilesystemSync(archive);

@@ -197,5 +197,5 @@ filenames = filesystem.listFiles();

mkdirp.sync(dest);
_results = [];
for (_i = 0, _len = filenames.length; _i < _len; _i++) {
filename = filenames[_i];
results = [];
for (i = 0, len = filenames.length; i < len; i++) {
filename = filenames[i];
filename = filename.substr(1);

@@ -205,3 +205,3 @@ destFilename = path.join(dest, filename);

if (file.files) {
_results.push(mkdirp.sync(destFilename));
results.push(mkdirp.sync(destFilename));
} else if (file.link) {

@@ -217,11 +217,11 @@ linkSrcPath = path.dirname(path.join(dest, file.link));

linkTo = path.join(relativePath, path.basename(file.link));
_results.push(fs.symlinkSync(linkTo, destFilename));
results.push(fs.symlinkSync(linkTo, destFilename));
} else {
content = disk.readFileSync(filesystem, filename, file);
_results.push(fs.writeFileSync(destFilename, content));
results.push(fs.writeFileSync(destFilename, content));
}
}
return _results;
return results;
};
}).call(this);

@@ -12,8 +12,8 @@ (function() {

return glob(dir + '/**/*', options, function(error, filenames) {
var filename, stat, _i, _len;
var filename, i, len, stat;
if (error) {
return callback(error);
}
for (_i = 0, _len = filenames.length; _i < _len; _i++) {
filename = filenames[_i];
for (i = 0, len = filenames.length; i < len; i++) {
filename = filenames[i];
stat = fs.lstatSync(filename);

@@ -20,0 +20,0 @@ if (stat.isFile()) {

@@ -38,3 +38,3 @@ (function() {

try {
copyFileToSync("" + dest + ".unpacked", filesystem.src, filename);
copyFileToSync(dest + ".unpacked", filesystem.src, filename);
} catch (_error) {

@@ -122,3 +122,3 @@ error = _error;

if (info.unpacked) {
buffer = fs.readFileSync(path.join("" + filesystem.src + ".unpacked", filename));
buffer = fs.readFileSync(path.join(filesystem.src + ".unpacked", filename));
} else {

@@ -125,0 +125,0 @@ fd = fs.openSync(filesystem.src, 'r');

@@ -20,7 +20,7 @@ (function() {

Filesystem.prototype.searchNodeFromDirectory = function(p) {
var dir, dirs, json, _i, _len;
var dir, dirs, i, json, len;
json = this.header;
dirs = p.split(path.sep);
for (_i = 0, _len = dirs.length; _i < _len; _i++) {
dir = dirs[_i];
for (i = 0, len = dirs.length; i < len; i++) {
dir = dirs[i];
if (dir !== '.') {

@@ -34,3 +34,3 @@ json = json.files[dir];

Filesystem.prototype.searchNodeFromPath = function(p) {
var name, node, _base;
var base, name, node;
p = path.relative(this.src, p);

@@ -45,4 +45,4 @@ if (!p) {

}
if ((_base = node.files)[name] == null) {
_base[name] = {};
if ((base = node.files)[name] == null) {
base[name] = {};
}

@@ -71,3 +71,3 @@ return node.files[name];

if (stat.size > 4294967295) {
throw new Error("" + p + ": file size can not be larger than 4.2GB");
throw new Error(p + ": file size can not be larger than 4.2GB");
}

@@ -86,3 +86,3 @@ node.size = stat.size;

if (link.substr(0, 2) === '..') {
throw new Error("" + p + ": file links out of the package");
throw new Error(p + ": file links out of the package");
}

@@ -97,13 +97,13 @@ node = this.searchNodeFromPath(p);

fillFilesFromHeader = function(p, json) {
var f, fullPath, _results;
var f, fullPath, results;
if (!json.files) {
return;
}
_results = [];
results = [];
for (f in json.files) {
fullPath = path.join(p, f);
files.push(fullPath);
_results.push(fillFilesFromHeader(fullPath, json.files[f]));
results.push(fillFilesFromHeader(fullPath, json.files[f]));
}
return _results;
return results;
};

@@ -110,0 +110,0 @@ fillFilesFromHeader('/', this.header);

@@ -36,8 +36,8 @@ (function() {

createSnapshot = function(src, dest, filenames, metadata, options, callback) {
var arch, builddir, compiled, content, error, file, filename, relativeFilename, script, snapshotdir, str, target, version, _i, _len;
var arch, builddir, compiled, content, error, file, filename, i, len, relativeFilename, script, snapshotdir, str, target, version;
try {
src = path.resolve(src);
content = {};
for (_i = 0, _len = filenames.length; _i < _len; _i++) {
filename = filenames[_i];
for (i = 0, len = filenames.length; i < len; i++) {
filename = filenames[i];
file = metadata[filename];

@@ -44,0 +44,0 @@ if ((file.type === 'file' || file.type === 'link') && filename.substr(-3) === '.js') {

@@ -5,3 +5,3 @@ {

"description": "Creating atom-shell app packages",
"version": "0.10.0",
"version": "0.11.0",
"bin": {

@@ -11,9 +11,9 @@ "asar": "bin/asar"

"license": "MIT",
"homepage": "https://github.com/atom/asar",
"homepage": "https://github.com/electron/asar",
"repository": {
"type": "git",
"url": "https://github.com/atom/asar.git"
"url": "https://github.com/electron/asar.git"
},
"bugs": {
"url": "https://github.com/atom/asar/issues"
"url": "https://github.com/electron/asar/issues"
},

@@ -33,3 +33,3 @@ "scripts": {

"mkdirp": "^0.5.0",
"mksnapshot": "^0.1.0"
"mksnapshot": "^0.3.0"
},

@@ -36,0 +36,0 @@ "devDependencies": {

@@ -1,5 +0,5 @@

# asar - Atom-Shell Archive
# asar - Electron Archive
[![build status](http://img.shields.io/travis/atom/asar.svg?style=flat-square)](https://travis-ci.org/atom/asar)
[![dependencies](http://img.shields.io/david/atom/asar.svg?style=flat-square)](https://david-dm.org/atom/asar)
[![build status](http://img.shields.io/travis/electron/asar.svg?style=flat-square)](https://travis-ci.org/electron/asar)
[![dependencies](http://img.shields.io/david/electron/asar.svg?style=flat-square)](https://david-dm.org/electron/asar)
[![npm version](http://img.shields.io/npm/v/asar.svg?style=flat-square)](https://npmjs.org/package/asar)

@@ -6,0 +6,0 @@

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