Skip to content

Commit 9f68498

Browse files
committed
docs: update quick start
1 parent dc609b4 commit 9f68498

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,21 @@ and [binary](https://github.com/substack/node-binary).
3131

3232
## Quick Start
3333

34-
1. Create an empty Parser object with `new Parser()` or `Parser.start()`.
35-
2. Chain methods to build your desired parser. (See
36-
[API](https://github.com/keichi/binary-parser#api) for detailed document of
37-
each method)
34+
1. Create an empty `Parser` object with `new Parser()` or `Parser.start()`.
35+
2. Chain methods to build your desired parser. (See [API](#api) for detailed
36+
documentation of each method)
3837
3. Call `Parser.prototype.parse` with a `Buffer`/`Uint8Array` object passed as
39-
an argument.
38+
its only argument.
4039
4. The parsed result will be returned as an object.
40+
- If parsing failed, an exception will be thrown.
4141

4242
```javascript
4343
// Module import
4444
const Parser = require("binary-parser").Parser;
4545

46+
// Alternative way to import the module
47+
// import { Parser } from "binary-parser";
48+
4649
// Build an IP packet header Parser
4750
const ipHeader = new Parser()
4851
.endianness("big")

0 commit comments

Comments
 (0)