Skip to content

Commit

Permalink
Add comments and extra fields
Browse files Browse the repository at this point in the history
  • Loading branch information
101arrowz committed Feb 11, 2021
1 parent 8cd8146 commit 4ed4e68
Show file tree
Hide file tree
Showing 13 changed files with 378 additions and 95 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.7.0
- Replace Adler-32 implementation (used in Zlib compression) with one more optimized for V8
- Advice from @SheetJSDev
- Add support for extra fields, file comments in ZIP files
- Work on Rust version
## 0.6.0
- Revamped streaming unzip for compatibility and performance improvements
- Fixed streaming data bugs
Expand Down
38 changes: 19 additions & 19 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,16 @@ ___

### deflateSync

**deflateSync**(`data`: Uint8Array, `opts`: [DeflateOptions](interfaces/deflateoptions.md)): Uint8Array
**deflateSync**(`data`: Uint8Array, `opts?`: [DeflateOptions](interfaces/deflateoptions.md)): Uint8Array

Compresses data with DEFLATE without any wrapper

#### Parameters:

Name | Type | Default value | Description |
------ | ------ | ------ | ------ |
`data` | Uint8Array | - | The data to compress |
`opts` | [DeflateOptions](interfaces/deflateoptions.md) | {} | The compression options |
Name | Type | Description |
------ | ------ | ------ |
`data` | Uint8Array | The data to compress |
`opts?` | [DeflateOptions](interfaces/deflateoptions.md) | The compression options |

**Returns:** Uint8Array

Expand Down Expand Up @@ -381,16 +381,16 @@ ___

### gzipSync

**gzipSync**(`data`: Uint8Array, `opts`: [GzipOptions](interfaces/gzipoptions.md)): Uint8Array
**gzipSync**(`data`: Uint8Array, `opts?`: [GzipOptions](interfaces/gzipoptions.md)): Uint8Array

Compresses data with GZIP

#### Parameters:

Name | Type | Default value | Description |
------ | ------ | ------ | ------ |
`data` | Uint8Array | - | The data to compress |
`opts` | [GzipOptions](interfaces/gzipoptions.md) | {} | The compression options |
Name | Type | Description |
------ | ------ | ------ |
`data` | Uint8Array | The data to compress |
`opts?` | [GzipOptions](interfaces/gzipoptions.md) | The compression options |

**Returns:** Uint8Array

Expand Down Expand Up @@ -593,17 +593,17 @@ ___

### zipSync

**zipSync**(`data`: [Zippable](interfaces/zippable.md), `opts`: [ZipOptions](interfaces/zipoptions.md)): Uint8Array
**zipSync**(`data`: [Zippable](interfaces/zippable.md), `opts?`: [ZipOptions](interfaces/zipoptions.md)): Uint8Array

Synchronously creates a ZIP file. Prefer using `zip` for better performance
with more than one file.

#### Parameters:

Name | Type | Default value | Description |
------ | ------ | ------ | ------ |
`data` | [Zippable](interfaces/zippable.md) | - | The directory structure for the ZIP archive |
`opts` | [ZipOptions](interfaces/zipoptions.md) | {} | The main options, merged with per-file options |
Name | Type | Description |
------ | ------ | ------ |
`data` | [Zippable](interfaces/zippable.md) | The directory structure for the ZIP archive |
`opts?` | [ZipOptions](interfaces/zipoptions.md) | The main options, merged with per-file options |

**Returns:** Uint8Array

Expand Down Expand Up @@ -648,9 +648,9 @@ Compress data with Zlib

#### Parameters:

Name | Type | Default value | Description |
------ | ------ | ------ | ------ |
`data` | Uint8Array | - | The data to compress |
`opts` | [ZlibOptions](interfaces/zliboptions.md) | {} | The compression options |
Name | Type | Description |
------ | ------ | ------ |
`data` | Uint8Array | The data to compress |
`opts` | [ZlibOptions](interfaces/zliboptions.md) | The compression options |

**Returns:** Uint8Array
28 changes: 23 additions & 5 deletions docs/classes/asynczipdeflate.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ Asynchronous streaming DEFLATE compression for ZIP archives
### Properties

* [attrs](asynczipdeflate.md#attrs)
* [comment](asynczipdeflate.md#comment)
* [compression](asynczipdeflate.md#compression)
* [crc](asynczipdeflate.md#crc)
* [extra](asynczipdeflate.md#extra)
* [filename](asynczipdeflate.md#filename)
* [flag](asynczipdeflate.md#flag)
* [mtime](asynczipdeflate.md#mtime)
Expand All @@ -38,16 +40,16 @@ Asynchronous streaming DEFLATE compression for ZIP archives

### constructor

\+ **new AsyncZipDeflate**(`filename`: string, `opts`: [DeflateOptions](../interfaces/deflateoptions.md)): [AsyncZipDeflate](asynczipdeflate.md)
\+ **new AsyncZipDeflate**(`filename`: string, `opts?`: [DeflateOptions](../interfaces/deflateoptions.md)): [AsyncZipDeflate](asynczipdeflate.md)

Creates a DEFLATE stream that can be added to ZIP archives

#### Parameters:

Name | Type | Default value | Description |
------ | ------ | ------ | ------ |
`filename` | string | - | The filename to associate with this data stream |
`opts` | [DeflateOptions](../interfaces/deflateoptions.md) | {} | The compression options |
Name | Type | Description |
------ | ------ | ------ |
`filename` | string | The filename to associate with this data stream |
`opts?` | [DeflateOptions](../interfaces/deflateoptions.md) | The compression options |

**Returns:** [AsyncZipDeflate](asynczipdeflate.md)

Expand All @@ -61,6 +63,14 @@ Name | Type | Default value | Description |

___

### comment

`Optional` **comment**: string

*Implementation of [ZipInputFile](../interfaces/zipinputfile.md).[comment](../interfaces/zipinputfile.md#comment)*

___

### compression

**compression**: number
Expand All @@ -77,6 +87,14 @@ ___

___

### extra

`Optional` **extra**: Record\<number, Uint8Array>

*Implementation of [ZipInputFile](../interfaces/zipinputfile.md).[extra](../interfaces/zipinputfile.md#extra)*

___

### filename

**filename**: string
Expand Down
28 changes: 23 additions & 5 deletions docs/classes/zipdeflate.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ for better performance
### Properties

* [attrs](zipdeflate.md#attrs)
* [comment](zipdeflate.md#comment)
* [compression](zipdeflate.md#compression)
* [crc](zipdeflate.md#crc)
* [extra](zipdeflate.md#extra)
* [filename](zipdeflate.md#filename)
* [flag](zipdeflate.md#flag)
* [mtime](zipdeflate.md#mtime)
Expand All @@ -38,16 +40,16 @@ for better performance

### constructor

\+ **new ZipDeflate**(`filename`: string, `opts`: [DeflateOptions](../interfaces/deflateoptions.md)): [ZipDeflate](zipdeflate.md)
\+ **new ZipDeflate**(`filename`: string, `opts?`: [DeflateOptions](../interfaces/deflateoptions.md)): [ZipDeflate](zipdeflate.md)

Creates a DEFLATE stream that can be added to ZIP archives

#### Parameters:

Name | Type | Default value | Description |
------ | ------ | ------ | ------ |
`filename` | string | - | The filename to associate with this data stream |
`opts` | [DeflateOptions](../interfaces/deflateoptions.md) | {} | The compression options |
Name | Type | Description |
------ | ------ | ------ |
`filename` | string | The filename to associate with this data stream |
`opts?` | [DeflateOptions](../interfaces/deflateoptions.md) | The compression options |

**Returns:** [ZipDeflate](zipdeflate.md)

Expand All @@ -61,6 +63,14 @@ Name | Type | Default value | Description |

___

### comment

`Optional` **comment**: string

*Implementation of [ZipInputFile](../interfaces/zipinputfile.md).[comment](../interfaces/zipinputfile.md#comment)*

___

### compression

**compression**: number
Expand All @@ -77,6 +87,14 @@ ___

___

### extra

`Optional` **extra**: Record\<number, Uint8Array>

*Implementation of [ZipInputFile](../interfaces/zipinputfile.md).[extra](../interfaces/zipinputfile.md#extra)*

___

### filename

**filename**: string
Expand Down
18 changes: 18 additions & 0 deletions docs/classes/zippassthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ A pass-through stream to keep data uncompressed in a ZIP archive.
### Properties

* [attrs](zippassthrough.md#attrs)
* [comment](zippassthrough.md#comment)
* [compression](zippassthrough.md#compression)
* [crc](zippassthrough.md#crc)
* [extra](zippassthrough.md#extra)
* [filename](zippassthrough.md#filename)
* [mtime](zippassthrough.md#mtime)
* [ondata](zippassthrough.md#ondata)
Expand Down Expand Up @@ -57,6 +59,14 @@ Name | Type | Description |

___

### comment

`Optional` **comment**: string

*Implementation of [ZipInputFile](../interfaces/zipinputfile.md).[comment](../interfaces/zipinputfile.md#comment)*

___

### compression

**compression**: number
Expand All @@ -73,6 +83,14 @@ ___

___

### extra

`Optional` **extra**: Record\<number, Uint8Array>

*Implementation of [ZipInputFile](../interfaces/zipinputfile.md).[extra](../interfaces/zipinputfile.md#extra)*

___

### filename

**filename**: string
Expand Down
29 changes: 29 additions & 0 deletions docs/interfaces/asynczipoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Options for asynchronously creating a ZIP archive
### Properties

* [attrs](asynczipoptions.md#attrs)
* [comment](asynczipoptions.md#comment)
* [consume](asynczipoptions.md#consume)
* [extra](asynczipoptions.md#extra)
* [level](asynczipoptions.md#level)
* [mem](asynczipoptions.md#mem)
* [mtime](asynczipoptions.md#mtime)
Expand Down Expand Up @@ -49,6 +51,18 @@ If you want to set the Unix permissions, for instance, just bit shift by 16, e.g

___

### comment

`Optional` **comment**: string

*Inherited from [ZipAttributes](zipattributes.md).[comment](zipattributes.md#comment)*

The comment to attach to the file. This field is defined by PKZIP's APPNOTE.txt,
section 4.4.26. The comment must be at most 65,535 bytes long UTF-8 encoded. This
field is not read by consumer software.

___

### consume

`Optional` **consume**: boolean
Expand All @@ -60,6 +74,21 @@ unusable but will increase performance and reduce memory usage.

___

### extra

`Optional` **extra**: Record\<number, Uint8Array>

*Inherited from [ZipAttributes](zipattributes.md).[extra](zipattributes.md#extra)*

Extra metadata to add to the file. This field is defined by PKZIP's APPNOTE.txt,
section 4.4.28. At most 65,535 bytes may be used in each ID. The ID must be an
integer between 0 and 65,535, inclusive.

This field is incredibly rare and almost never needed except for compliance with
proprietary standards and software.

___

### level

`Optional` **level**: 0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9
Expand Down
25 changes: 25 additions & 0 deletions docs/interfaces/zipattributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Attributes for files added to a ZIP archive object
### Properties

* [attrs](zipattributes.md#attrs)
* [comment](zipattributes.md#comment)
* [extra](zipattributes.md#extra)
* [mtime](zipattributes.md#mtime)
* [os](zipattributes.md#os)

Expand Down Expand Up @@ -46,6 +48,29 @@ If you want to set the Unix permissions, for instance, just bit shift by 16, e.g

___

### comment

`Optional` **comment**: string

The comment to attach to the file. This field is defined by PKZIP's APPNOTE.txt,
section 4.4.26. The comment must be at most 65,535 bytes long UTF-8 encoded. This
field is not read by consumer software.

___

### extra

`Optional` **extra**: Record\<number, Uint8Array>

Extra metadata to add to the file. This field is defined by PKZIP's APPNOTE.txt,
section 4.4.28. At most 65,535 bytes may be used in each ID. The ID must be an
integer between 0 and 65,535, inclusive.

This field is incredibly rare and almost never needed except for compliance with
proprietary standards and software.

___

### mtime

`Optional` **mtime**: GzipOptions[\"mtime\"]
Expand Down
29 changes: 29 additions & 0 deletions docs/interfaces/zipinputfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ A stream that can be used to create a file in a ZIP archive
### Properties

* [attrs](zipinputfile.md#attrs)
* [comment](zipinputfile.md#comment)
* [compression](zipinputfile.md#compression)
* [crc](zipinputfile.md#crc)
* [extra](zipinputfile.md#extra)
* [filename](zipinputfile.md#filename)
* [flag](zipinputfile.md#flag)
* [mtime](zipinputfile.md#mtime)
Expand Down Expand Up @@ -57,6 +59,18 @@ If you want to set the Unix permissions, for instance, just bit shift by 16, e.g

___

### comment

`Optional` **comment**: string

*Inherited from [ZipAttributes](zipattributes.md).[comment](zipattributes.md#comment)*

The comment to attach to the file. This field is defined by PKZIP's APPNOTE.txt,
section 4.4.26. The comment must be at most 65,535 bytes long UTF-8 encoded. This
field is not read by consumer software.

___

### compression

**compression**: number
Expand All @@ -81,6 +95,21 @@ ZipDeflate or AsyncZipDeflate.

___

### extra

`Optional` **extra**: Record\<number, Uint8Array>

*Inherited from [ZipAttributes](zipattributes.md).[extra](zipattributes.md#extra)*

Extra metadata to add to the file. This field is defined by PKZIP's APPNOTE.txt,
section 4.4.28. At most 65,535 bytes may be used in each ID. The ID must be an
integer between 0 and 65,535, inclusive.

This field is incredibly rare and almost never needed except for compliance with
proprietary standards and software.

___

### filename

**filename**: string
Expand Down
Loading

0 comments on commit 4ed4e68

Please sign in to comment.