Skip to content

feat(zip): windows and linux support - #687

Open
triniwiz wants to merge 3 commits into
mainfrom
feat/zip-windows-linux
Open

triniwiz wants to merge 3 commits into
mainfrom
feat/zip-windows-linux

Conversation

@triniwiz

@triniwiz triniwiz commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Adds Windows and Linux support to @nativescript/zip.

Stacked on #658 (macOS support). Until #658 is merged, this diff also shows its two commits. Only feat(zip): windows and linux support is new here.

Approach

Both platforms run the work natively, off the JS thread. The public API and index.d.ts are unchanged.

Platform Engine JS wrapper
Windows platforms/windows/src/ZipArchiver.cs: managed C# compiled into the app, using .NET DeflateStream and BCL cryptography. ZipAsync/UnzipAsync return a Task and report progress through an Action<int>. index.windows.ts
Linux platforms/linux: a small C wrapper (src/nszip.c, public API in include/nszip.h) on a vendored, pinned minizip-ng 4.2.2 (src/minizip-ng, see VENDORED.md). It links the system zlib, GLib and OpenSSL libcrypto. Jobs run on a GThread; progress and completion are posted to the GLib main context. Only nszip_zip/nszip_unzip are exported (-fvisibility=hidden). index.linux.ts (via interop.callback)

Behaviour on both platforms

  • Streaming: memory use stays constant regardless of archive or entry size. ZIP64 is supported for archives larger than 4 GB or with more than 65,535 entries.
  • Passwords: creating an archive with password uses WinZip AES-256, matching iOS and Android. Unzipping supports AES and legacy ZipCrypto.
  • Verified extraction: each entry is written to a temporary file in the target folder and moved into place only after the size, CRC and AES authentication checks pass. A failed or corrupt entry never replaces an existing file.
  • Unsafe input: the extractor skips or rejects
    • entries that would land outside the destination (../, absolute paths, drive letters),
    • symbolic-link entries,
    • paths through symlinked or reparse-point directories,
    • archives whose entries overlap,
    • archives whose declared size exceeds the free disk space.
      It also stops an entry as soon as it produces more data than it declares. On Windows, reserved device names, alternate data streams and trailing dots or spaces are neutralised.
  • Zipping:
    • the output archive is never added to itself,
    • symlinks are only followed when they point inside the source folder,
    • setuid/setgid bits are not stored.
  • Options and progress: overwrite: false keeps existing files, and keepParent works as before. Progress is reported in whole percent and never goes backwards.

Linux build requirement

Apps that use the plugin need the OpenSSL development headers to build: libssl-dev (Debian/Ubuntu/Pop!_OS) or openssl-devel (Fedora). End users need nothing extra, since zlib, GLib and libcrypto.so.3 are part of the base system on current desktop distributions. This is documented in the README.

Testing

  • Round trips: zip and unzip, with and without a password, keepParent, forced ZIP64, and a 4.5 GB entry. Peak memory was about 8 MB for C and about 50 MB for C# (the .NET baseline).
  • Interop: output reads in Info-ZIP unzip -t, Python zipfile and pyzipper (AES). Both engines extract Info-ZIP, ZipCrypto and pyzipper AES archives byte-identical.
  • Crafted archives: both engines correctly reject or neutralise:
    • a decompression bomb and an overlapping-entries bomb,
    • out-of-range offsets and sizes,
    • a bogus ZIP64 end record,
    • zip-slip and symlink tricks,
    • tampered AES data.
  • Fuzzing:
    • Linux (C): sanitizer-clean under ASan + UBSan on macOS (clang) and Linux (clang, with LeakSanitizer).
    • C#: run on .NET 9; no unexpected exception types.
  • Linux build: the shared library builds with gcc and the plugin's native.json flags on Pop!_OS 24.04, and links only libz.so.1, libglib-2.0.so.0 and libcrypto.so.3.

Not yet verified inside the Windows and Linux NativeScript runtimes. Please exercise the demo app on both, especially the NSWinRT task/delegate bridge on Windows and the interop.callback glue on Linux.

DjDeveloperr and others added 2 commits February 13, 2026 22:07
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 076bb816-857b-4413-891c-abfc541df021

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Comment thread packages/zip/zip-archive.ts Fixed
Comment thread packages/zip/zip-archive.ts Fixed
Comment thread packages/zip/zip-archive.ts Fixed
Windows: managed C# engine (platforms/windows/src/ZipArchiver.cs) on .NET
DeflateStream and BCL cryptography, running off the JS thread.

Linux: native engine (platforms/linux) on a vendored, pinned minizip-ng 4.2.2
with system zlib, GLib and OpenSSL libcrypto. Work runs on a GThread and reports
progress/completion on the GLib main context.

Both stream data (constant memory, ZIP64), write WinZip AES-256 when a password
is given, read AES and ZipCrypto archives, and extract into temporary files that
are only moved into place after the size, CRC and AES authentication checks pass.
@triniwiz
triniwiz force-pushed the feat/zip-windows-linux branch from 9cdde36 to fe03b81 Compare November 14, 2026 18:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants