Skip to content

Commit a4d8ad9

Browse files
authored
docs: fix up README and add API docs link (#383)
* docs: fix up README and add API docs link * Update README.md
1 parent db29fbd commit a4d8ad9

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22

33
[![Test](https://github.com/electron/asar/actions/workflows/test.yml/badge.svg)](https://github.com/electron/asar/actions/workflows/test.yml)
44
[![npm version](http://img.shields.io/npm/v/@electron/asar.svg)](https://npmjs.org/package/@electron/asar)
5+
[![API docs](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.npmjs.org%2F%40electron%2Fasar%2Flatest&query=%24.version&logo=typescript&logoColor=white&label=API%20Docs)](https://packages.electronjs.org/asar)
56

6-
Asar is a simple extensive archive format, it works like `tar` that concatenates
7-
all files together without compression, while having random access support.
7+
ASAR is a simple extensive archive format. It concatenates all files together without compression
8+
(like [`tar`](https://www.gnu.org/software/tar/)) while having random access support.
89

910
## Features
1011

1112
* Support random access
12-
* Use JSON to store files' information
13+
* Use JSON to store file information
1314
* Very easy to write a parser
1415

15-
## Command line utility
16+
## CLI
1617

1718
### Install
1819

1920
This module requires Node 22.12.0 or later.
2021

2122
```bash
22-
$ npm install --engine-strict @electron/asar
23+
npm install --engine-strict @electron/asar
2324
```
2425

2526
### Usage
@@ -54,7 +55,8 @@ $ asar --help
5455
#### Excluding multiple resources from being packed
5556

5657
Given:
57-
```
58+
59+
```text
5860
app
5961
(a) ├── x1
6062
(b) ├── x2
@@ -67,21 +69,26 @@ Given:
6769
```
6870

6971
Exclude: a, b
72+
7073
```bash
71-
$ asar pack app app.asar --unpack-dir "{x1,x2}"
74+
asar pack app app.asar --unpack-dir "{x1,x2}"
7275
```
7376

7477
Exclude: a, b, d, f
78+
7579
```bash
76-
$ asar pack app app.asar --unpack-dir "**/{x1,x2}"
80+
asar pack app app.asar --unpack-dir "**/{x1,x2}"
7781
```
7882

7983
Exclude: a, b, d, f, h
84+
8085
```bash
81-
$ asar pack app app.asar --unpack-dir "{**/x1,**/x2,z4/w1}"
86+
asar pack app app.asar --unpack-dir "{**/x1,**/x2,z4/w1}"
8287
```
8388

84-
## Using programmatically
89+
## Programmatic usage
90+
91+
For full API usage, see the [API documentation](https://packages.electronjs.org/asar).
8592

8693
### Example
8794

@@ -98,6 +105,7 @@ console.log('done.');
98105
Please note that there is currently **no** error handling provided!
99106

100107
### Transform
108+
101109
You can pass in a `transform` option, that is a function, which either returns
102110
nothing, or a `stream.Transform`. The latter will be used on files that will be
103111
in the `.asar` file to transform them (e.g. compress).
@@ -122,7 +130,7 @@ Asar uses [Pickle][pickle] to safely serialize binary value to file.
122130

123131
The format of asar is very flat:
124132

125-
```
133+
```markdown
126134
| UInt32: header_size | String: header | Bytes: file1 | ... | Bytes: file42 |
127135
```
128136

@@ -200,9 +208,10 @@ because file size in Node.js is represented as `Number` and it is not safe to
200208
convert `Number` to UINT64.
201209

202210
`integrity` is an object consisting of a few keys:
211+
203212
* A hashing `algorithm`, currently only `SHA256` is supported.
204213
* A hex encoded `hash` value representing the hash of the entire file.
205-
* An array of hex encoded hashes for the `blocks` of the file. i.e. for a blockSize of 4KB this array contains the hash of every block if you split the file into N 4KB blocks.
206-
* A integer value `blockSize` representing the size in bytes of each block in the `blocks` hashes above
214+
* An array of hex encoded hashes for the `blocks` of the file (i.e. for a blockSize of 4KB, this array contains the hash of every block if you split the file into N 4KB blocks).
215+
* A integer value `blockSize` representing the size in bytes of each block in the `blocks` hashes above.
207216

208217
[pickle]: https://chromium.googlesource.com/chromium/src/+/main/base/pickle.h

0 commit comments

Comments
 (0)