7zip-native 0.0.7 → 0.0.10
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/README.md +96 -24
- package/bench/compare.mts +25 -11
- package/bench/folder-concurrency.mts +56 -14
- package/bench/multiprocess-extract.cjs +334 -0
- package/dist/index.cjs +194 -102
- package/dist/index.d.cts +10 -9
- package/dist/index.d.mts +10 -9
- package/dist/index.d.ts +10 -9
- package/dist/index.mjs +196 -104
- package/native/addon.cpp +1399 -71
- package/package.json +5 -3
- package/patches/deflate-input-buffer-size.patch +47 -0
- package/prebuilds/darwin-arm64/7zip_native.node +0 -0
- package/prebuilds/darwin-arm64/lib7z.dylib +0 -0
- package/prebuilds/darwin-x64/7zip_native.node +0 -0
- package/prebuilds/darwin-x64/lib7z.dylib +0 -0
- package/prebuilds/linux-arm/7z.so +0 -0
- package/prebuilds/linux-arm/7zip_native.node +0 -0
- package/prebuilds/linux-arm64/7z.so +0 -0
- package/prebuilds/linux-arm64/7zip_native.node +0 -0
- package/prebuilds/linux-ia32/7z.so +0 -0
- package/prebuilds/linux-ia32/7zip_native.node +0 -0
- package/prebuilds/linux-x64/7z.so +0 -0
- package/prebuilds/linux-x64/7zip_native.node +0 -0
- package/prebuilds/win32-arm64/7z.dll +0 -0
- package/prebuilds/win32-arm64/7zip_native.node +0 -0
- package/prebuilds/win32-x64/7z.dll +0 -0
- package/prebuilds/win32-x64/7zip_native.node +0 -0
- package/scripts/build-native.mjs +22 -1
- package/vendor/7zip/CPP/7zip/Archive/Archive2.def +1 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7z.so +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zAes.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zAesRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zBuf2.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zCompressionMode.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zCrc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zCrcOpt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zDecode.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zEncode.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zExtract.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zFolderInStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zHandlerOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zHeader.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zProperties.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zSpecStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/7zUpdate.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Aes.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/AesOpt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Alloc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ApfsHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ApmHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ArHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ArchiveExports.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ArjHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BZip2Crc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BZip2Decoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BZip2Encoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BZip2Register.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Base64Handler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Bcj2.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Bcj2Coder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Bcj2Enc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Bcj2Register.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BcjCoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BcjRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BitlDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Blake2s.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Bra.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Bra86.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BraIA64.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BranchMisc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BranchRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/BwtSort.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ByteSwap.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Bz2Handler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CRC.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CWrappers.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CabBlockInStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CabHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CabHeader.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CabIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CabRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ChmHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ChmIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CodecExports.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CoderMixer2.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ComHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CopyCoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CopyRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CpioHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CpuArch.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CramfsHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CrcReg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/CreateCoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Deflate64Register.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DeflateDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DeflateEncoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DeflateProps.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DeflateRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Delta.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DeltaFilter.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DllExports2.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DmgHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DummyOutStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/DynLimBuf.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ElfHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ExtHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FatHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FileDir.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FileFind.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FileIO.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FileName.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FilterCoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FindSignature.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/FlvHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/GptHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/GzHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/HandlerCont.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/HandlerOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/HfsHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/HmacSha1.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/HmacSha256.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/HuffEnc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/IhexHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ImplodeDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/InBuffer.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/InOutTempBuffer.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/InStreamWithCRC.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/IntToString.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/IsoHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/IsoHeader.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/IsoIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/IsoRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ItemNameUtils.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LimitedStreams.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LockedStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LpHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzFind.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzFindMt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzFindOpt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzFindPrepare.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzOutWindow.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzfseDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzhDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzhHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Lzma2Dec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Lzma2DecMt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Lzma2Decoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Lzma2Enc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Lzma2Encoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Lzma2Register.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzmaDec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzmaDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzmaEnc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzmaEncoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzmaHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzmaRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzmsDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/LzxDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MachoHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MbrHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Md5.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Md5Reg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MemBlocks.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MethodId.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MethodProps.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MslzHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MtCoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MtDec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MubHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MultiStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MyAes.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MyAesReg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MyMap.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MyString.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MyVector.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MyWindows.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/MyXml.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/NewHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/NsisDecode.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/NsisHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/NsisIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/NsisRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/NtfsHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/OffsetStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/OutBuffer.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/OutMemStream.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/OutStreamWithCRC.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/OutStreamWithSha1.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ParseProperties.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Pbkdf2HmacSha1.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PeHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Ppmd7.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Ppmd7Dec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Ppmd7Enc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Ppmd7aDec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Ppmd8.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Ppmd8Dec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Ppmd8Enc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PpmdDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PpmdEncoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PpmdHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PpmdRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PpmdZip.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ProgressMt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ProgressUtils.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PropId.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PropVariant.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PropVariantConv.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/PropVariantUtils.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/QcowHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/QuantumDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/RandGen.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar1Decoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar20Crypto.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar2Decoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar3Decoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar3Vm.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar5Aes.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar5Decoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Rar5Handler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/RarAes.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/RarCodecsRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/RarHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/RpmHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha1.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha1Opt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha1Prepare.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha1Reg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha256.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha256Opt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha256Prepare.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha256Reg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha3.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha3Reg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha512.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha512Opt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha512Prepare.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sha512Reg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ShrinkDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Sort.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/SparseHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/SplitHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/SquashfsHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/StreamBinder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/StreamObjects.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/StreamUtils.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/StringConvert.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/StringToInt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/SwapBytes.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/SwfHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Synchronization.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/System.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TarHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TarHandlerOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TarHeader.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TarIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TarOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TarRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TarUpdate.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Threads.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/TimeUtils.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/UTFConvert.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/UdfHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/UdfIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/UefiHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/UniqBlocks.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/VdiHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/VhdHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/VhdxHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/VirtThread.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/VmdkHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Wildcard.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/WimHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/WimHandlerOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/WimIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/WimRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/WzAes.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XarHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XpressDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Xxh64.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Xxh64Reg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/Xz.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzCrc64.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzCrc64Init.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzCrc64Opt.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzCrc64Reg.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzDec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzEnc.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzEncoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/XzIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipAddCommon.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipCrypto.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipHandlerOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipIn.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipItem.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipOut.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipRegister.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipStrong.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZipUpdate.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZlibDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZlibEncoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZstdDec.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZstdDecoder.o +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/_o/ZstdHandler.o +0 -0
- package/vendor/7zip/CPP/7zip/Compress/DeflateDecoder.cpp +15 -1
- package/scripts/clean-upstream-build.mjs +0 -9
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,6 @@ var node_os = require('node:os');
|
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
var node_stream = require('node:stream');
|
|
10
10
|
var promises$1 = require('node:stream/promises');
|
|
11
|
-
var node_url = require('node:url');
|
|
12
11
|
|
|
13
12
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
13
|
class ArchiveError extends Error {
|
|
@@ -21,6 +20,9 @@ class ArchiveError extends Error {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
const defaultMaxOutputBytes = 4n * 1024n * 1024n * 1024n;
|
|
23
|
+
const defaultDeflateBufferSize = 32 * 1024;
|
|
24
|
+
const minDeflateBufferSize = 4 * 1024;
|
|
25
|
+
const maxDeflateBufferSize = 2 * 1024 * 1024;
|
|
24
26
|
function normalizeMaxBytes(value, label) {
|
|
25
27
|
if (value === undefined) {
|
|
26
28
|
return defaultMaxOutputBytes;
|
|
@@ -47,7 +49,7 @@ if (process.platform === 'win32') {
|
|
|
47
49
|
else if (process.platform === 'darwin') {
|
|
48
50
|
engineName = 'lib7z.dylib';
|
|
49
51
|
}
|
|
50
|
-
const packageDirectory = node_path.dirname(
|
|
52
|
+
const packageDirectory = node_path.dirname(require$1.resolve('7zip-native'));
|
|
51
53
|
const runtimeDirectory = [
|
|
52
54
|
node_path.resolve(packageDirectory, `../prebuilds/${process.platform}-${process.arch}`),
|
|
53
55
|
node_path.resolve(packageDirectory, '../build/Release'),
|
|
@@ -160,6 +162,19 @@ async function assertReplaceableOutput(filePath) {
|
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
}
|
|
165
|
+
async function assertFolderOutputDoesNotExist(filePath) {
|
|
166
|
+
try {
|
|
167
|
+
await promises.lstat(filePath);
|
|
168
|
+
const error = new Error(`Output file already exists: ${filePath}`);
|
|
169
|
+
Object.assign(error, { code: 'EEXIST' });
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
if (error.code !== 'ENOENT') {
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
163
178
|
async function assertOutputDoesNotExist(filePath) {
|
|
164
179
|
try {
|
|
165
180
|
await promises.lstat(filePath);
|
|
@@ -189,7 +204,7 @@ async function normalizeCreateEntry(entry) {
|
|
|
189
204
|
if (details.isSymbolicLink() || !details.isFile()) {
|
|
190
205
|
throw new ArchiveError('ERR_ARCHIVE_CREATE', `Archive creation source is not a regular file: ${sourcePath}`);
|
|
191
206
|
}
|
|
192
|
-
return { sourcePath, path: internalPath };
|
|
207
|
+
return { sourcePath, path: internalPath, mtimeMs: details.mtimeMs };
|
|
193
208
|
}
|
|
194
209
|
async function ensureExtractionRoot(root) {
|
|
195
210
|
try {
|
|
@@ -319,6 +334,7 @@ class Archive {
|
|
|
319
334
|
handle;
|
|
320
335
|
closed = false;
|
|
321
336
|
entriesPromise;
|
|
337
|
+
entryIndexes;
|
|
322
338
|
constructor(handle) {
|
|
323
339
|
this.handle = handle;
|
|
324
340
|
}
|
|
@@ -343,8 +359,14 @@ class Archive {
|
|
|
343
359
|
throw new RangeError('Password exceeds the 1 MiB native password limit');
|
|
344
360
|
}
|
|
345
361
|
}
|
|
362
|
+
const deflateBufferSize = options.deflateBufferSize ?? defaultDeflateBufferSize;
|
|
363
|
+
if (!Number.isSafeInteger(deflateBufferSize)
|
|
364
|
+
|| deflateBufferSize < minDeflateBufferSize
|
|
365
|
+
|| deflateBufferSize > maxDeflateBufferSize) {
|
|
366
|
+
throw new RangeError(`Deflate buffer size must be an integer between ${minDeflateBufferSize} and ${maxDeflateBufferSize} bytes`);
|
|
367
|
+
}
|
|
346
368
|
try {
|
|
347
|
-
const handle = await native.open(node_path.resolve(path), options.password, enginePath);
|
|
369
|
+
const handle = await native.open(node_path.resolve(path), options.password, enginePath, deflateBufferSize);
|
|
348
370
|
return new Archive(handle);
|
|
349
371
|
}
|
|
350
372
|
catch (cause) {
|
|
@@ -386,7 +408,7 @@ class Archive {
|
|
|
386
408
|
if (extension === '.7z') {
|
|
387
409
|
format = '7z';
|
|
388
410
|
}
|
|
389
|
-
else if (extension === '.zip'
|
|
411
|
+
else if (extension === '.zip') {
|
|
390
412
|
format = 'zip';
|
|
391
413
|
}
|
|
392
414
|
else if (extension === '.tar') {
|
|
@@ -456,7 +478,23 @@ class Archive {
|
|
|
456
478
|
if (typeof idOrPath === 'number' && (!Number.isSafeInteger(idOrPath) || idOrPath < 0)) {
|
|
457
479
|
throw new RangeError('Entry ID must be a non-negative safe integer');
|
|
458
480
|
}
|
|
459
|
-
|
|
481
|
+
const entries = await this.entries();
|
|
482
|
+
if (!this.entryIndexes) {
|
|
483
|
+
const pathEntries = Object.create(null);
|
|
484
|
+
const idEntries = Object.create(null);
|
|
485
|
+
for (const entry of entries) {
|
|
486
|
+
pathEntries[entry.path] ??= entry;
|
|
487
|
+
idEntries[entry.id] ??= entry;
|
|
488
|
+
}
|
|
489
|
+
this.entryIndexes = { pathEntries, idEntries };
|
|
490
|
+
}
|
|
491
|
+
if (typeof idOrPath === 'number') {
|
|
492
|
+
return this.entryIndexes.idEntries[idOrPath];
|
|
493
|
+
}
|
|
494
|
+
if (typeof idOrPath === 'string') {
|
|
495
|
+
return this.entryIndexes.pathEntries[idOrPath];
|
|
496
|
+
}
|
|
497
|
+
return undefined;
|
|
460
498
|
}
|
|
461
499
|
async extract(idOrPathOrPaths) {
|
|
462
500
|
this.assertOpen();
|
|
@@ -534,9 +572,6 @@ class Archive {
|
|
|
534
572
|
|| options.concurrency > 128)) {
|
|
535
573
|
throw new RangeError('Folder extraction concurrency must be an integer between 1 and 128');
|
|
536
574
|
}
|
|
537
|
-
if (options.onProgress !== undefined && typeof options.onProgress !== 'function') {
|
|
538
|
-
throw new TypeError('Folder extraction onProgress option must be a function');
|
|
539
|
-
}
|
|
540
575
|
if (options.onExtract !== undefined && typeof options.onExtract !== 'function') {
|
|
541
576
|
throw new TypeError('Folder extraction onExtract option must be a function');
|
|
542
577
|
}
|
|
@@ -579,33 +614,13 @@ class Archive {
|
|
|
579
614
|
}
|
|
580
615
|
const root = node_path.resolve(destination);
|
|
581
616
|
const plans = makeOutputPlans(root, selectedEntries);
|
|
582
|
-
const
|
|
583
|
-
if (maxBytes !== null &&
|
|
617
|
+
const totalBytes = selectedEntries.reduce((total, entry) => total + (entry.isDirectory ? 0n : entry.size), 0n);
|
|
618
|
+
if (maxBytes !== null && totalBytes > maxBytes) {
|
|
584
619
|
throw new ArchiveError('ERR_RESOURCE_LIMIT', `Folder output exceeds the ${maxBytes}-byte limit`);
|
|
585
620
|
}
|
|
586
621
|
options.signal?.throwIfAborted();
|
|
587
622
|
await ensureExtractionRoot(root);
|
|
588
|
-
let extractedBytes = 0n;
|
|
589
623
|
let filesExtracted = 0;
|
|
590
|
-
const totalFiles = plans.filter(plan => !plan.isDirectory).length;
|
|
591
|
-
const reportProgress = () => {
|
|
592
|
-
let percent = 0;
|
|
593
|
-
if (expectedBytes > 0n) {
|
|
594
|
-
const scaledPercent = extractedBytes * 10000n / expectedBytes;
|
|
595
|
-
percent = Number(scaledPercent > 9900n ? 9900n : scaledPercent) / 100;
|
|
596
|
-
}
|
|
597
|
-
if (filesExtracted === totalFiles) {
|
|
598
|
-
percent = 100;
|
|
599
|
-
}
|
|
600
|
-
options.onProgress?.({
|
|
601
|
-
filesExtracted,
|
|
602
|
-
totalFiles,
|
|
603
|
-
bytesProcessed: extractedBytes,
|
|
604
|
-
totalBytes: expectedBytes,
|
|
605
|
-
percent,
|
|
606
|
-
});
|
|
607
|
-
};
|
|
608
|
-
reportProgress();
|
|
609
624
|
for (const plan of plans) {
|
|
610
625
|
options.signal?.throwIfAborted();
|
|
611
626
|
if (plan.isDirectory) {
|
|
@@ -617,7 +632,6 @@ class Archive {
|
|
|
617
632
|
const extractionSignal = controller.signal;
|
|
618
633
|
let hasFailure = false;
|
|
619
634
|
let failure;
|
|
620
|
-
let nextFileIndex = 0;
|
|
621
635
|
const stop = (error) => {
|
|
622
636
|
if (!hasFailure) {
|
|
623
637
|
hasFailure = true;
|
|
@@ -631,78 +645,77 @@ class Archive {
|
|
|
631
645
|
stop(options.signal?.reason);
|
|
632
646
|
};
|
|
633
647
|
options.signal?.addEventListener('abort', abortFromCaller, { once: true });
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
648
|
+
const groupCount = Math.min(concurrency, filePlans.length);
|
|
649
|
+
const fileGroups = Array.from({ length: groupCount }, () => []);
|
|
650
|
+
filePlans.forEach((plan, index) => {
|
|
651
|
+
fileGroups[index % groupCount].push(plan);
|
|
652
|
+
});
|
|
653
|
+
const extractGroup = async (group) => {
|
|
654
|
+
const outputs = [];
|
|
655
|
+
let completionFailed = false;
|
|
656
|
+
let completionFailure;
|
|
657
|
+
try {
|
|
658
|
+
for (const plan of group) {
|
|
659
|
+
await ensureOutputParents(root, plan.targetPath);
|
|
660
|
+
extractionSignal.throwIfAborted();
|
|
661
|
+
if (options.overwrite) {
|
|
662
|
+
await assertReplaceableOutput(plan.targetPath);
|
|
646
663
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
return;
|
|
664
|
+
else {
|
|
665
|
+
await assertFolderOutputDoesNotExist(plan.targetPath);
|
|
650
666
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
const temporaryPath = node_path.join(node_path.dirname(plan.targetPath), `.7zip-native-${node_crypto.randomUUID()}.tmp`);
|
|
657
|
-
try {
|
|
658
|
-
await promises$1.pipeline(this.createReadStream(plan.entry.id, {
|
|
659
|
-
signal: extractionSignal,
|
|
660
|
-
maxBytes: null,
|
|
661
|
-
}), limit, node_fs.createWriteStream(temporaryPath, { flags: 'wx', mode: 0o600 }), { signal: extractionSignal });
|
|
662
|
-
extractionSignal.throwIfAborted();
|
|
663
|
-
await assertReplaceableOutput(plan.targetPath);
|
|
664
|
-
extractionSignal.throwIfAborted();
|
|
665
|
-
await promises.rename(temporaryPath, plan.targetPath);
|
|
667
|
+
outputs.push({
|
|
668
|
+
id: plan.entry.id,
|
|
669
|
+
path: plan.targetPath,
|
|
670
|
+
overwrite: options.overwrite === true,
|
|
671
|
+
});
|
|
666
672
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
673
|
+
let onFileCompleted;
|
|
674
|
+
const onExtract = options.onExtract;
|
|
675
|
+
if (onExtract) {
|
|
676
|
+
const plansById = new Map(group.map(plan => [plan.entry.id, plan]));
|
|
677
|
+
onFileCompleted = (id) => {
|
|
678
|
+
if (completionFailed || hasFailure) {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
try {
|
|
682
|
+
const plan = plansById.get(id);
|
|
683
|
+
if (plan === undefined) {
|
|
684
|
+
throw new ArchiveError('ERR_ARCHIVE_EXTRACT', 'Native folder extraction returned an unknown file completion');
|
|
685
|
+
}
|
|
686
|
+
extractionSignal.throwIfAborted();
|
|
687
|
+
filesExtracted++;
|
|
688
|
+
onExtract({
|
|
689
|
+
entry: plan.entry,
|
|
690
|
+
outputPath: plan.targetPath,
|
|
691
|
+
percent: filesExtracted * 100 / filePlans.length,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
catch (error) {
|
|
695
|
+
completionFailed = true;
|
|
696
|
+
completionFailure = error;
|
|
697
|
+
stop(error);
|
|
698
|
+
}
|
|
699
|
+
};
|
|
670
700
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
signal: extractionSignal,
|
|
675
|
-
maxBytes: null,
|
|
676
|
-
}), limit, node_fs.createWriteStream(plan.targetPath, { flags: 'wx', mode: 0o600 }), { signal: extractionSignal });
|
|
677
|
-
}
|
|
678
|
-
filesExtracted++;
|
|
679
|
-
reportProgress();
|
|
680
|
-
options.onExtract?.({ entry: plan.entry, outputPath: plan.targetPath });
|
|
681
|
-
};
|
|
682
|
-
const runWorker = async () => {
|
|
683
|
-
while (!hasFailure) {
|
|
684
|
-
if (options.signal?.aborted) {
|
|
685
|
-
stop(options.signal.reason);
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
const plan = filePlans[nextFileIndex++];
|
|
689
|
-
if (!plan) {
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
try {
|
|
693
|
-
await extractFile(plan);
|
|
694
|
-
}
|
|
695
|
-
catch (error) {
|
|
696
|
-
stop(error);
|
|
697
|
-
return;
|
|
701
|
+
await this.extractEntriesToFiles(outputs, extractionSignal, onFileCompleted);
|
|
702
|
+
if (completionFailed) {
|
|
703
|
+
throw completionFailure;
|
|
698
704
|
}
|
|
699
705
|
}
|
|
706
|
+
catch (caughtError) {
|
|
707
|
+
throw completionFailed ? completionFailure : caughtError;
|
|
708
|
+
}
|
|
700
709
|
};
|
|
701
710
|
try {
|
|
702
711
|
options.signal?.throwIfAborted();
|
|
703
|
-
const workers =
|
|
704
|
-
|
|
705
|
-
|
|
712
|
+
const workers = fileGroups.map(group => extractGroup(group));
|
|
713
|
+
try {
|
|
714
|
+
await Promise.all(workers);
|
|
715
|
+
}
|
|
716
|
+
catch (error) {
|
|
717
|
+
stop(error);
|
|
718
|
+
await Promise.allSettled(workers);
|
|
706
719
|
throw failure;
|
|
707
720
|
}
|
|
708
721
|
}
|
|
@@ -710,8 +723,67 @@ class Archive {
|
|
|
710
723
|
options.signal?.removeEventListener('abort', abortFromCaller);
|
|
711
724
|
}
|
|
712
725
|
}
|
|
713
|
-
async read(
|
|
726
|
+
async read(idOrPathOrPaths, options) {
|
|
714
727
|
this.assertOpen();
|
|
728
|
+
const maxUInt64 = (1n << 64n) - 1n;
|
|
729
|
+
const normalizeRange = (range) => {
|
|
730
|
+
const offset = this.toUnsignedBigInt(range.offset ?? 0, 'offset');
|
|
731
|
+
const length = this.toUnsignedBigInt(range.length, 'length');
|
|
732
|
+
if (offset > maxUInt64 || length > maxUInt64 - offset) {
|
|
733
|
+
throw new ArchiveError('ERR_INVALID_RANGE', 'Read range exceeds the native 64-bit offset limit');
|
|
734
|
+
}
|
|
735
|
+
return { offset, length };
|
|
736
|
+
};
|
|
737
|
+
if (options === undefined) {
|
|
738
|
+
if (!Array.isArray(idOrPathOrPaths)) {
|
|
739
|
+
throw new TypeError('Read options are required for an entry selector');
|
|
740
|
+
}
|
|
741
|
+
const requests = idOrPathOrPaths;
|
|
742
|
+
const normalized = await Promise.all(requests.map(async (request) => {
|
|
743
|
+
if (!request || typeof request !== 'object' || !('entry' in request)) {
|
|
744
|
+
throw new TypeError('Batch read requests must include an entry selector');
|
|
745
|
+
}
|
|
746
|
+
const range = normalizeRange(request);
|
|
747
|
+
return {
|
|
748
|
+
id: await this.resolveEntryId(request.entry),
|
|
749
|
+
...range,
|
|
750
|
+
};
|
|
751
|
+
}));
|
|
752
|
+
if (!normalized.length) {
|
|
753
|
+
return [];
|
|
754
|
+
}
|
|
755
|
+
try {
|
|
756
|
+
return await native.readMany(this.handle, normalized);
|
|
757
|
+
}
|
|
758
|
+
catch (cause) {
|
|
759
|
+
throw extractionError(cause);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
const isBatch = Array.isArray(idOrPathOrPaths);
|
|
763
|
+
let selectors;
|
|
764
|
+
if (isBatch) {
|
|
765
|
+
selectors = idOrPathOrPaths;
|
|
766
|
+
}
|
|
767
|
+
else {
|
|
768
|
+
selectors = [idOrPathOrPaths];
|
|
769
|
+
}
|
|
770
|
+
const { offset, length } = normalizeRange(options);
|
|
771
|
+
if (isBatch) {
|
|
772
|
+
const ids = await Promise.all(selectors.map(selector => this.resolveEntryId(selector)));
|
|
773
|
+
const uniqueIds = [...new Set(ids)];
|
|
774
|
+
if (!uniqueIds.length) {
|
|
775
|
+
return [];
|
|
776
|
+
}
|
|
777
|
+
try {
|
|
778
|
+
const buffers = await native.readMany(this.handle, uniqueIds.map(id => ({ id, offset, length })));
|
|
779
|
+
const buffersById = new Map(uniqueIds.map((id, index) => [id, buffers[index]]));
|
|
780
|
+
return ids.map(id => buffersById.get(id));
|
|
781
|
+
}
|
|
782
|
+
catch (cause) {
|
|
783
|
+
throw extractionError(cause);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
const idOrPath = selectors[0];
|
|
715
787
|
let id;
|
|
716
788
|
if (typeof idOrPath === 'number') {
|
|
717
789
|
this.validateIds([idOrPath]);
|
|
@@ -720,12 +792,6 @@ class Archive {
|
|
|
720
792
|
else {
|
|
721
793
|
id = await this.resolveEntryId(idOrPath);
|
|
722
794
|
}
|
|
723
|
-
const offset = this.toUnsignedBigInt(options.offset ?? 0, 'offset');
|
|
724
|
-
const length = this.toUnsignedBigInt(options.length, 'length');
|
|
725
|
-
const maxUInt64 = (1n << 64n) - 1n;
|
|
726
|
-
if (offset > maxUInt64 || length > maxUInt64 - offset) {
|
|
727
|
-
throw new ArchiveError('ERR_INVALID_RANGE', 'Read range exceeds the native 64-bit offset limit');
|
|
728
|
-
}
|
|
729
795
|
try {
|
|
730
796
|
return await native.read(this.handle, id, offset, length);
|
|
731
797
|
}
|
|
@@ -733,6 +799,32 @@ class Archive {
|
|
|
733
799
|
throw extractionError(cause);
|
|
734
800
|
}
|
|
735
801
|
}
|
|
802
|
+
async extractEntriesToFiles(outputs, signal, onFileCompleted) {
|
|
803
|
+
let task;
|
|
804
|
+
const cancelTask = () => {
|
|
805
|
+
if (task) {
|
|
806
|
+
native.cancelExtractToFiles(task.taskId);
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
try {
|
|
810
|
+
signal.throwIfAborted();
|
|
811
|
+
task = native.startExtractToFiles(this.handle, outputs, onFileCompleted);
|
|
812
|
+
signal.addEventListener('abort', cancelTask, { once: true });
|
|
813
|
+
if (signal.aborted) {
|
|
814
|
+
cancelTask();
|
|
815
|
+
}
|
|
816
|
+
return await task.promise;
|
|
817
|
+
}
|
|
818
|
+
catch (cause) {
|
|
819
|
+
if (signal.aborted) {
|
|
820
|
+
throw signal.reason ?? cause;
|
|
821
|
+
}
|
|
822
|
+
throw extractionError(cause);
|
|
823
|
+
}
|
|
824
|
+
finally {
|
|
825
|
+
signal.removeEventListener('abort', cancelTask);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
736
828
|
async close() {
|
|
737
829
|
if (this.closed) {
|
|
738
830
|
return;
|
package/dist/index.d.cts
CHANGED
|
@@ -16,8 +16,12 @@ interface ReadOptions {
|
|
|
16
16
|
readonly offset?: number | bigint;
|
|
17
17
|
readonly length: number | bigint;
|
|
18
18
|
}
|
|
19
|
+
interface ReadRequest extends ReadOptions {
|
|
20
|
+
readonly entry: EntrySelector;
|
|
21
|
+
}
|
|
19
22
|
interface OpenOptions {
|
|
20
23
|
readonly password?: string;
|
|
24
|
+
readonly deflateBufferSize?: number;
|
|
21
25
|
}
|
|
22
26
|
type ArchiveFormat = '7z' | 'zip' | 'tar' | 'wim';
|
|
23
27
|
interface ArchiveCreateEntry {
|
|
@@ -29,16 +33,10 @@ interface CreateArchiveOptions {
|
|
|
29
33
|
readonly compressionLevel?: number;
|
|
30
34
|
readonly overwrite?: boolean;
|
|
31
35
|
}
|
|
32
|
-
interface ExtractToFolderProgress {
|
|
33
|
-
readonly filesExtracted: number;
|
|
34
|
-
readonly totalFiles: number;
|
|
35
|
-
readonly bytesProcessed: bigint;
|
|
36
|
-
readonly totalBytes: bigint;
|
|
37
|
-
readonly percent: number;
|
|
38
|
-
}
|
|
39
36
|
interface ExtractedArchiveFile {
|
|
40
37
|
readonly entry: ArchiveEntry;
|
|
41
38
|
readonly outputPath: string;
|
|
39
|
+
readonly percent: number;
|
|
42
40
|
}
|
|
43
41
|
interface ReadStreamOptions {
|
|
44
42
|
readonly highWaterMark?: number;
|
|
@@ -50,7 +48,6 @@ interface ExtractToFolderOptions {
|
|
|
50
48
|
readonly paths?: readonly string[];
|
|
51
49
|
readonly concurrency?: number;
|
|
52
50
|
readonly overwrite?: boolean;
|
|
53
|
-
readonly onProgress?: (progress: ExtractToFolderProgress) => void;
|
|
54
51
|
readonly onExtract?: (result: ExtractedArchiveFile) => void;
|
|
55
52
|
readonly maxBytes?: number | bigint | null;
|
|
56
53
|
readonly signal?: AbortSignal;
|
|
@@ -65,6 +62,7 @@ declare class Archive {
|
|
|
65
62
|
private readonly handle;
|
|
66
63
|
private closed;
|
|
67
64
|
private entriesPromise?;
|
|
65
|
+
private entryIndexes?;
|
|
68
66
|
private constructor();
|
|
69
67
|
static concurrency(value?: number): number;
|
|
70
68
|
static open(path: string, options?: OpenOptions): Promise<Archive>;
|
|
@@ -77,6 +75,9 @@ declare class Archive {
|
|
|
77
75
|
extractToStream(idOrPath: EntrySelector, destination: Writable, options?: ReadStreamOptions): Promise<void>;
|
|
78
76
|
extractToFolder(destination: string, options?: ExtractToFolderOptions): Promise<void>;
|
|
79
77
|
read(idOrPath: EntrySelector, options: ReadOptions): Promise<Buffer>;
|
|
78
|
+
read(idsOrPaths: readonly EntrySelector[], options: ReadOptions): Promise<Buffer[]>;
|
|
79
|
+
read(requests: readonly ReadRequest[]): Promise<Buffer[]>;
|
|
80
|
+
private extractEntriesToFiles;
|
|
80
81
|
close(): Promise<void>;
|
|
81
82
|
private assertOpen;
|
|
82
83
|
private validateIds;
|
|
@@ -86,4 +87,4 @@ declare class Archive {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
export { Archive, ArchiveError };
|
|
89
|
-
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions,
|
|
90
|
+
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions, ExtractedArchiveFile, OpenOptions, ReadOptions, ReadRequest, ReadStreamOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -16,8 +16,12 @@ interface ReadOptions {
|
|
|
16
16
|
readonly offset?: number | bigint;
|
|
17
17
|
readonly length: number | bigint;
|
|
18
18
|
}
|
|
19
|
+
interface ReadRequest extends ReadOptions {
|
|
20
|
+
readonly entry: EntrySelector;
|
|
21
|
+
}
|
|
19
22
|
interface OpenOptions {
|
|
20
23
|
readonly password?: string;
|
|
24
|
+
readonly deflateBufferSize?: number;
|
|
21
25
|
}
|
|
22
26
|
type ArchiveFormat = '7z' | 'zip' | 'tar' | 'wim';
|
|
23
27
|
interface ArchiveCreateEntry {
|
|
@@ -29,16 +33,10 @@ interface CreateArchiveOptions {
|
|
|
29
33
|
readonly compressionLevel?: number;
|
|
30
34
|
readonly overwrite?: boolean;
|
|
31
35
|
}
|
|
32
|
-
interface ExtractToFolderProgress {
|
|
33
|
-
readonly filesExtracted: number;
|
|
34
|
-
readonly totalFiles: number;
|
|
35
|
-
readonly bytesProcessed: bigint;
|
|
36
|
-
readonly totalBytes: bigint;
|
|
37
|
-
readonly percent: number;
|
|
38
|
-
}
|
|
39
36
|
interface ExtractedArchiveFile {
|
|
40
37
|
readonly entry: ArchiveEntry;
|
|
41
38
|
readonly outputPath: string;
|
|
39
|
+
readonly percent: number;
|
|
42
40
|
}
|
|
43
41
|
interface ReadStreamOptions {
|
|
44
42
|
readonly highWaterMark?: number;
|
|
@@ -50,7 +48,6 @@ interface ExtractToFolderOptions {
|
|
|
50
48
|
readonly paths?: readonly string[];
|
|
51
49
|
readonly concurrency?: number;
|
|
52
50
|
readonly overwrite?: boolean;
|
|
53
|
-
readonly onProgress?: (progress: ExtractToFolderProgress) => void;
|
|
54
51
|
readonly onExtract?: (result: ExtractedArchiveFile) => void;
|
|
55
52
|
readonly maxBytes?: number | bigint | null;
|
|
56
53
|
readonly signal?: AbortSignal;
|
|
@@ -65,6 +62,7 @@ declare class Archive {
|
|
|
65
62
|
private readonly handle;
|
|
66
63
|
private closed;
|
|
67
64
|
private entriesPromise?;
|
|
65
|
+
private entryIndexes?;
|
|
68
66
|
private constructor();
|
|
69
67
|
static concurrency(value?: number): number;
|
|
70
68
|
static open(path: string, options?: OpenOptions): Promise<Archive>;
|
|
@@ -77,6 +75,9 @@ declare class Archive {
|
|
|
77
75
|
extractToStream(idOrPath: EntrySelector, destination: Writable, options?: ReadStreamOptions): Promise<void>;
|
|
78
76
|
extractToFolder(destination: string, options?: ExtractToFolderOptions): Promise<void>;
|
|
79
77
|
read(idOrPath: EntrySelector, options: ReadOptions): Promise<Buffer>;
|
|
78
|
+
read(idsOrPaths: readonly EntrySelector[], options: ReadOptions): Promise<Buffer[]>;
|
|
79
|
+
read(requests: readonly ReadRequest[]): Promise<Buffer[]>;
|
|
80
|
+
private extractEntriesToFiles;
|
|
80
81
|
close(): Promise<void>;
|
|
81
82
|
private assertOpen;
|
|
82
83
|
private validateIds;
|
|
@@ -86,4 +87,4 @@ declare class Archive {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
export { Archive, ArchiveError };
|
|
89
|
-
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions,
|
|
90
|
+
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions, ExtractedArchiveFile, OpenOptions, ReadOptions, ReadRequest, ReadStreamOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,8 +16,12 @@ interface ReadOptions {
|
|
|
16
16
|
readonly offset?: number | bigint;
|
|
17
17
|
readonly length: number | bigint;
|
|
18
18
|
}
|
|
19
|
+
interface ReadRequest extends ReadOptions {
|
|
20
|
+
readonly entry: EntrySelector;
|
|
21
|
+
}
|
|
19
22
|
interface OpenOptions {
|
|
20
23
|
readonly password?: string;
|
|
24
|
+
readonly deflateBufferSize?: number;
|
|
21
25
|
}
|
|
22
26
|
type ArchiveFormat = '7z' | 'zip' | 'tar' | 'wim';
|
|
23
27
|
interface ArchiveCreateEntry {
|
|
@@ -29,16 +33,10 @@ interface CreateArchiveOptions {
|
|
|
29
33
|
readonly compressionLevel?: number;
|
|
30
34
|
readonly overwrite?: boolean;
|
|
31
35
|
}
|
|
32
|
-
interface ExtractToFolderProgress {
|
|
33
|
-
readonly filesExtracted: number;
|
|
34
|
-
readonly totalFiles: number;
|
|
35
|
-
readonly bytesProcessed: bigint;
|
|
36
|
-
readonly totalBytes: bigint;
|
|
37
|
-
readonly percent: number;
|
|
38
|
-
}
|
|
39
36
|
interface ExtractedArchiveFile {
|
|
40
37
|
readonly entry: ArchiveEntry;
|
|
41
38
|
readonly outputPath: string;
|
|
39
|
+
readonly percent: number;
|
|
42
40
|
}
|
|
43
41
|
interface ReadStreamOptions {
|
|
44
42
|
readonly highWaterMark?: number;
|
|
@@ -50,7 +48,6 @@ interface ExtractToFolderOptions {
|
|
|
50
48
|
readonly paths?: readonly string[];
|
|
51
49
|
readonly concurrency?: number;
|
|
52
50
|
readonly overwrite?: boolean;
|
|
53
|
-
readonly onProgress?: (progress: ExtractToFolderProgress) => void;
|
|
54
51
|
readonly onExtract?: (result: ExtractedArchiveFile) => void;
|
|
55
52
|
readonly maxBytes?: number | bigint | null;
|
|
56
53
|
readonly signal?: AbortSignal;
|
|
@@ -65,6 +62,7 @@ declare class Archive {
|
|
|
65
62
|
private readonly handle;
|
|
66
63
|
private closed;
|
|
67
64
|
private entriesPromise?;
|
|
65
|
+
private entryIndexes?;
|
|
68
66
|
private constructor();
|
|
69
67
|
static concurrency(value?: number): number;
|
|
70
68
|
static open(path: string, options?: OpenOptions): Promise<Archive>;
|
|
@@ -77,6 +75,9 @@ declare class Archive {
|
|
|
77
75
|
extractToStream(idOrPath: EntrySelector, destination: Writable, options?: ReadStreamOptions): Promise<void>;
|
|
78
76
|
extractToFolder(destination: string, options?: ExtractToFolderOptions): Promise<void>;
|
|
79
77
|
read(idOrPath: EntrySelector, options: ReadOptions): Promise<Buffer>;
|
|
78
|
+
read(idsOrPaths: readonly EntrySelector[], options: ReadOptions): Promise<Buffer[]>;
|
|
79
|
+
read(requests: readonly ReadRequest[]): Promise<Buffer[]>;
|
|
80
|
+
private extractEntriesToFiles;
|
|
80
81
|
close(): Promise<void>;
|
|
81
82
|
private assertOpen;
|
|
82
83
|
private validateIds;
|
|
@@ -86,4 +87,4 @@ declare class Archive {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
export { Archive, ArchiveError };
|
|
89
|
-
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions,
|
|
90
|
+
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions, ExtractedArchiveFile, OpenOptions, ReadOptions, ReadRequest, ReadStreamOptions };
|