Code Monkey home page Code Monkey logo

asar's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asar's Issues

Add example for encoding/writing ASAR files

Based on the given documentation/tests, I struggle implementing a way to encode and write the contents of a directory to an ASAR file.

Would it be possible to extend the documentation, as to make it more clear how to achieve writing ASAR files?

Cannot Reencode ASAR

I've found that opening an ASAR file and attempting to reencode it directly leads to issues on the archive format.

When attempting to decode an ASAR generated with this library, I get the following error;

invalid character '\x00' looking for beginning of value

Electron doesn't want to open this file either and asar crashes with a stack error.

I suspect the header might be wrongly encoded.

Does not support addon

If there is addon in asar, it cannot be decompressed.

e.g: ps-list \ node-raw-socket

My asar contains these two packages, but after extracting them, the directory is empty:

I added some logs to the code, the code looks like this:

realPath := filepath.Join(target, path)
if entry.Flags&asar.FlagDir != 0 {
	return os.MkdirAll(realPath, 0755)
}
if entry.Flags&asar.FlagUnpacked != 0 {
	fmt.Println("x1")
	fmt.Println(path)
	fmt.Println(realPath)
	return nil
}

The output of the console is:

When I use electron/asar, there is no problem

read corruption

I have a test scenario where reading an ASAR file generated by electron-builder "succeeds" but produces corrupt output.

Go code:

func TestAsar(t *testing.T) {

	p := "/tmp/app.asar"
	f, err := os.Open(p)
	if err != nil {
		t.Fatal(err)
	}
	e, err := asar.Decode(f)
	if err != nil {
		t.Fatal(err)
	}

	homeE := e.Find("public", "home.html")

	r := homeE.Open()

	b, err := ioutil.ReadAll(r)
	if err != nil {
		t.Fatal(err)
	}

	log.Printf("b: %s", b)
}

Produces output like:

=== RUN   TestAsar
2017/06/26 16:43:43 b: tml>
<head>
.
.
.
</body>
</html>
<h
--- PASS: TestAsar (0.00s)

As you can see it has cut off 2 bytes at the start of the file and there are an extra 2 bytes at the end (I can't tell if those last two bytes are the 2 bytes of this same file or another html file).

The .asar file is 17mb and not something I want to post publicly but if you are able to take a look I can share with you on DropBox or other similar way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.