new Head(chunk, offset)
Parameters:
| Name | Type | Description |
|---|---|---|
chunk |
Chunk | the chunk to point to |
offset |
number | the byte offset inside the chunk |
Methods
-
read(n) → {Promise.<Buffer>}
-
Reads a maximum number of bytes.
Parameters:
Name Type Description nnumber | string number of bytes, e.g. '4mb' Returns:
- a buffer with length less or equal n- Type
- Promise.<Buffer>
-
seek(n) → {Promise.<Head>}
-
Seeks forward a given number of bytes.
Parameters:
Name Type Description nnumber | string number of bytes, e.g. '4mb' Returns:
- a new head if enough bytes are left, null otherwise- Type
- Promise.<Head>