original-fs-asar
v0.12.7
Published
Fork of asar that requires 'original-fs' instead of 'fs' so asar packages can be created and extracted in Electron applications. This is nessecary because Electron has its own version of 'fs' that the standard asar module is not compatible with.
Downloads
12
Readme
asar - Electron Archive
Asar is a simple extensive archive format, it works like tar
that concatenates
all files together without compression, while having random access support.
Features
- Support random access
- Use JSON to store files' information
- Very easy to write a parser
Command line utility
Install
$ npm install original-fs-asar
Usage
Only runs inside of Electron.
Using programatically
Example
var asar = require('original-fs-asar');
var src = 'some/path/';
var dest = 'name.asar';
asar.createPackage(src, dest, function() {
console.log('done.');
})
Please note that there is currently no error handling provided!
Transform
You can pass in a transform
option, that is a function, which either returns
nothing, or a stream.Transform
. The latter will be used on files that will be
in the .asar
file to transform them (e.g. compress).
var asar = require('original-fs-asar');
var src = 'some/path/';
var dest = 'name.asar';
function transform(filename) {
return new CustomTransformStream()
}
asar.createPackageWithOptions(src, dest, { transform: transform }, function() {
console.log('done.');
})