@t4h.framework/zip 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/LICENSE +21 -0
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @t4h.framework/zip
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#163](https://github.com/tech4humans-brasil/framework/pull/163) [`f7540fc`](https://github.com/tech4humans-brasil/framework/commit/f7540fcc38ee0da651677474e5bd825bcbecea9c) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds `@t4h.framework/zip`: reading ZIP archives from inside a workflow.
|
|
8
|
+
|
|
9
|
+
`unzip(archive, options?)` extracts the entries into files and resolves with
|
|
10
|
+
`ZipEntry[]` — `{ path, binary, contentLength, compressedLength,
|
|
11
|
+
compressionMethod, crc32, lastModifiedAt, directory }` — and
|
|
12
|
+
`list(archive, options?)` returns the same metadata without transferring any
|
|
13
|
+
content. `include`/`exclude` globs select what is extracted or listed,
|
|
14
|
+
`encoding` decodes legacy entry names and `contentType` labels the extracted
|
|
15
|
+
files.
|
|
16
|
+
|
|
17
|
+
Both read the archive back to front through `FileSystemClaim.slice`: the tail
|
|
18
|
+
of the file gives the whole listing (about a kilobyte on an archive without a
|
|
19
|
+
comment) and each entry is fetched by byte range, inflated in a stream and
|
|
20
|
+
written through `FileSystemClaim.write` with backpressure — content never
|
|
21
|
+
enters workflow memory or the history, and extracting one file out of a large
|
|
22
|
+
archive does not download the archive. A binary the claim cannot slice (SFTP,
|
|
23
|
+
HTTP) is streamed once into a durable copy first, the same trade `split` makes.
|
|
24
|
+
|
|
25
|
+
Every entry is verified against its CRC-32 and declared size while it flows to
|
|
26
|
+
storage, and the inflate is aborted the moment the output goes past that size,
|
|
27
|
+
so an entry that lies never writes more than it declares. Entry paths that
|
|
28
|
+
escape the extraction directory, encrypted entries and compression methods
|
|
29
|
+
other than stored and deflate are refused. ZIP64, data descriptors, archive
|
|
30
|
+
comments, UTF-8 and legacy names are handled.
|
|
31
|
+
|
|
32
|
+
This replaces hand-rolled lazy `Binary` subclasses that inflate on `stream()`
|
|
33
|
+
in App code: those are serialized as activity input, cannot be rehydrated after
|
|
34
|
+
a replay in another process, and have to lie about `contentLength`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tech for humans
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/zip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "ZIP extraction module for the T4H Framework",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/zip",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|