Skip to content

Commit 935fb54

Browse files
committed
document the extraFields option.
1 parent 2291128 commit 935fb54

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ After UTF-8 encoding, `metadataPath` must be at most `0xffff` bytes in length.
6767
mode: stats.mode,
6868
compress: true,
6969
forceZip64Format: false,
70+
extraFields: [],
7071
fileComment: "", // or a UTF-8 Buffer
7172
}
7273
```
@@ -85,6 +86,8 @@ If `forceZip64Format` is `true`, yazl will use ZIP64 format in this entry's Data
8586
and Central Directory Record regardless of if it's required or not (this may be useful for testing.).
8687
Otherwise, yazl will use ZIP64 format where necessary.
8788

89+
Each entry in `extraFields` should be tagged data of the form `{id: id, data: data}`. See the [`yauzl` docs](https://github.com/thejoshwolfe/yauzl#extrafields) for more.
90+
8891
If `fileComment` is a `string`, it will be encoded with UTF-8.
8992
If `fileComment` is a `Buffer`, it should be a UTF-8 encoded string.
9093
In UTF-8, `fileComment` must be at most `0xffff` bytes in length.
@@ -107,12 +110,13 @@ See `addFile()` for info about the `metadataPath` parameter.
107110
mode: 0o100664,
108111
compress: true,
109112
forceZip64Format: false,
113+
extraFields: [],
110114
fileComment: "", // or a UTF-8 Buffer
111115
size: 12345, // example value
112116
}
113117
```
114118

115-
See `addFile()` for the meaning of `mtime`, `mode`, `compress`, `forceZip64Format`, and `fileComment`.
119+
See `addFile()` for the meaning of `mtime`, `mode`, `compress`, `forceZip64Format`, `extraFields`, and `fileComment`.
116120
If `size` is given, it will be checked against the actual number of bytes in the `readStream`,
117121
and an error will be emitted if there is a mismatch.
118122

@@ -132,11 +136,12 @@ See `addFile()` for info about the `metadataPath` parameter.
132136
mode: 0o100664,
133137
compress: true,
134138
forceZip64Format: false,
139+
extraFields: [],
135140
fileComment: "", // or a UTF-8 Buffer
136141
}
137142
```
138143

139-
See `addFile()` for the meaning of `mtime`, `mode`, `compress`, `forceZip64Format`, and `fileComment`.
144+
See `addFile()` for the meaning of `mtime`, `mode`, `compress`, `forceZip64Format`, `extraFields`, and `fileComment`.
140145

141146
This method has the unique property that General Purpose Bit `3` will not be used in the Local File Header.
142147
This doesn't matter for unzip implementations that conform to the Zip File Spec.

0 commit comments

Comments
 (0)