7zip-native 0.0.6 → 0.0.8
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 +83 -12
- package/bench/folder-concurrency.mts +192 -0
- package/dist/index.cjs +229 -21
- package/dist/index.d.cts +19 -2
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.mjs +219 -11
- package/native/addon.cpp +470 -0
- package/package.json +4 -3
- package/prebuilds/darwin-arm64/7zip_native.node +0 -0
- package/prebuilds/darwin-x64/7zip_native.node +0 -0
- package/prebuilds/linux-arm/7zip_native.node +0 -0
- package/prebuilds/linux-arm64/7zip_native.node +0 -0
- package/prebuilds/linux-ia32/7zip_native.node +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/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/scripts/clean-upstream-build.mjs +0 -9
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_fs = require('node:fs');
|
|
4
|
-
var promises
|
|
4
|
+
var promises = require('node:fs/promises');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
6
|
var node_module = require('node:module');
|
|
7
7
|
var node_os = require('node:os');
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
var node_stream = require('node:stream');
|
|
10
|
-
var promises = require('node:stream/promises');
|
|
11
|
-
var node_url = require('node:url');
|
|
10
|
+
var promises$1 = require('node:stream/promises');
|
|
12
11
|
|
|
13
12
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
13
|
class ArchiveError extends Error {
|
|
@@ -47,7 +46,7 @@ if (process.platform === 'win32') {
|
|
|
47
46
|
else if (process.platform === 'darwin') {
|
|
48
47
|
engineName = 'lib7z.dylib';
|
|
49
48
|
}
|
|
50
|
-
const packageDirectory = node_path.dirname(
|
|
49
|
+
const packageDirectory = node_path.dirname(require$1.resolve('7zip-native'));
|
|
51
50
|
const runtimeDirectory = [
|
|
52
51
|
node_path.resolve(packageDirectory, `../prebuilds/${process.platform}-${process.arch}`),
|
|
53
52
|
node_path.resolve(packageDirectory, '../build/Release'),
|
|
@@ -76,10 +75,32 @@ function safeEntrySegments(entryPath) {
|
|
|
76
75
|
}
|
|
77
76
|
return segments;
|
|
78
77
|
}
|
|
78
|
+
function sanitizeOutputPath(entryPath) {
|
|
79
|
+
if (process.platform !== 'win32') {
|
|
80
|
+
return entryPath;
|
|
81
|
+
}
|
|
82
|
+
return entryPath
|
|
83
|
+
.replace(/([. ]+)([\\/]|$)/g, (_match, unsupported, separator) => '_'.repeat(unsupported.length) + separator)
|
|
84
|
+
.replace(/[<>:|?*"]/g, '_');
|
|
85
|
+
}
|
|
86
|
+
function assertSafeRelativeArchivePath(entryPath) {
|
|
87
|
+
const normalized = entryPath.replace(/\\/g, '/');
|
|
88
|
+
const segments = normalized.split('/').filter(segment => segment !== '' && segment !== '.');
|
|
89
|
+
if (entryPath.includes('\0')
|
|
90
|
+
|| normalized.startsWith('/')
|
|
91
|
+
|| /^[a-zA-Z]:/.test(normalized)
|
|
92
|
+
|| segments.length === 0
|
|
93
|
+
|| segments.some(segment => segment === '..')) {
|
|
94
|
+
throw new ArchiveError('ERR_ARCHIVE_PATH', `Unsafe archive entry path: ${entryPath}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
79
97
|
function makeOutputPlans(root, entries) {
|
|
80
98
|
const caseInsensitivePaths = process.platform === 'win32' || process.platform === 'darwin';
|
|
81
99
|
const plans = entries.map((entry) => {
|
|
82
|
-
|
|
100
|
+
if (process.platform === 'win32') {
|
|
101
|
+
assertSafeRelativeArchivePath(entry.path);
|
|
102
|
+
}
|
|
103
|
+
const segments = safeEntrySegments(sanitizeOutputPath(entry.path));
|
|
83
104
|
const targetPath = node_path.resolve(root, ...segments);
|
|
84
105
|
const relative = node_path.relative(root, targetPath);
|
|
85
106
|
if (relative === ''
|
|
@@ -113,21 +134,21 @@ function makeOutputPlans(root, entries) {
|
|
|
113
134
|
}
|
|
114
135
|
async function ensureDirectory(directoryPath) {
|
|
115
136
|
try {
|
|
116
|
-
await promises
|
|
137
|
+
await promises.mkdir(directoryPath, { mode: 0o700 });
|
|
117
138
|
}
|
|
118
139
|
catch (error) {
|
|
119
140
|
if (error.code !== 'EEXIST') {
|
|
120
141
|
throw error;
|
|
121
142
|
}
|
|
122
143
|
}
|
|
123
|
-
const details = await promises
|
|
144
|
+
const details = await promises.lstat(directoryPath);
|
|
124
145
|
if (details.isSymbolicLink() || !details.isDirectory()) {
|
|
125
146
|
throw new ArchiveError('ERR_ARCHIVE_PATH', `Destination path is not a real directory: ${directoryPath}`);
|
|
126
147
|
}
|
|
127
148
|
}
|
|
128
149
|
async function assertReplaceableOutput(filePath) {
|
|
129
150
|
try {
|
|
130
|
-
const details = await promises
|
|
151
|
+
const details = await promises.lstat(filePath);
|
|
131
152
|
if (!details.isFile()) {
|
|
132
153
|
throw new ArchiveError('ERR_ARCHIVE_PATH', `Cannot replace a non-file extraction target: ${filePath}`);
|
|
133
154
|
}
|
|
@@ -138,9 +159,40 @@ async function assertReplaceableOutput(filePath) {
|
|
|
138
159
|
}
|
|
139
160
|
}
|
|
140
161
|
}
|
|
162
|
+
async function assertOutputDoesNotExist(filePath) {
|
|
163
|
+
try {
|
|
164
|
+
await promises.lstat(filePath);
|
|
165
|
+
throw new ArchiveError('ERR_ARCHIVE_CREATE', `Output archive already exists: ${filePath}`);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
if (error instanceof ArchiveError || error.code !== 'ENOENT') {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async function normalizeCreateEntry(entry) {
|
|
174
|
+
if (entry === null || typeof entry !== 'object'
|
|
175
|
+
|| typeof entry.sourcePath !== 'string' || entry.sourcePath.length === 0
|
|
176
|
+
|| typeof entry.path !== 'string' || entry.path.length === 0) {
|
|
177
|
+
throw new TypeError('Each archive creation entry must have non-empty sourcePath and path strings');
|
|
178
|
+
}
|
|
179
|
+
const internalPath = safeEntrySegments(entry.path).join('/');
|
|
180
|
+
const sourcePath = node_path.resolve(entry.sourcePath);
|
|
181
|
+
let details;
|
|
182
|
+
try {
|
|
183
|
+
details = await promises.lstat(sourcePath);
|
|
184
|
+
}
|
|
185
|
+
catch (cause) {
|
|
186
|
+
throw new ArchiveError('ERR_ARCHIVE_CREATE', `Unable to access archive creation source: ${sourcePath}`, { cause });
|
|
187
|
+
}
|
|
188
|
+
if (details.isSymbolicLink() || !details.isFile()) {
|
|
189
|
+
throw new ArchiveError('ERR_ARCHIVE_CREATE', `Archive creation source is not a regular file: ${sourcePath}`);
|
|
190
|
+
}
|
|
191
|
+
return { sourcePath, path: internalPath };
|
|
192
|
+
}
|
|
141
193
|
async function ensureExtractionRoot(root) {
|
|
142
194
|
try {
|
|
143
|
-
const details = await promises
|
|
195
|
+
const details = await promises.lstat(root);
|
|
144
196
|
if (details.isSymbolicLink() || !details.isDirectory()) {
|
|
145
197
|
throw new ArchiveError('ERR_ARCHIVE_PATH', `Destination is not a real directory: ${root}`);
|
|
146
198
|
}
|
|
@@ -151,8 +203,8 @@ async function ensureExtractionRoot(root) {
|
|
|
151
203
|
throw error;
|
|
152
204
|
}
|
|
153
205
|
}
|
|
154
|
-
await promises
|
|
155
|
-
const details = await promises
|
|
206
|
+
await promises.mkdir(root, { recursive: true, mode: 0o700 });
|
|
207
|
+
const details = await promises.lstat(root);
|
|
156
208
|
if (details.isSymbolicLink() || !details.isDirectory()) {
|
|
157
209
|
throw new ArchiveError('ERR_ARCHIVE_PATH', `Destination is not a real directory: ${root}`);
|
|
158
210
|
}
|
|
@@ -299,6 +351,99 @@ class Archive {
|
|
|
299
351
|
throw new ArchiveError(/password/i.test(message) ? 'ERR_ARCHIVE_PASSWORD' : 'ERR_ARCHIVE_OPEN', message, { cause });
|
|
300
352
|
}
|
|
301
353
|
}
|
|
354
|
+
static async create(outputPath, entries, options = {}) {
|
|
355
|
+
if (typeof outputPath !== 'string' || outputPath.length === 0) {
|
|
356
|
+
throw new TypeError('Output archive path must be a non-empty string');
|
|
357
|
+
}
|
|
358
|
+
if (!Array.isArray(entries)) {
|
|
359
|
+
throw new TypeError('Archive creation entries must be an array');
|
|
360
|
+
}
|
|
361
|
+
if (entries.length > 1_000_000) {
|
|
362
|
+
throw new RangeError('Archive creation exceeds the 1,000,000-entry limit');
|
|
363
|
+
}
|
|
364
|
+
if (options === null || typeof options !== 'object') {
|
|
365
|
+
throw new TypeError('Archive creation options must be an object');
|
|
366
|
+
}
|
|
367
|
+
if (options.overwrite !== undefined && typeof options.overwrite !== 'boolean') {
|
|
368
|
+
throw new TypeError('Archive creation overwrite option must be a boolean');
|
|
369
|
+
}
|
|
370
|
+
const compressionLevel = options.compressionLevel ?? 5;
|
|
371
|
+
if (!Number.isSafeInteger(compressionLevel) || compressionLevel < 0 || compressionLevel > 9) {
|
|
372
|
+
throw new RangeError('Compression level must be an integer between 0 and 9');
|
|
373
|
+
}
|
|
374
|
+
const targetPath = node_path.resolve(outputPath);
|
|
375
|
+
let format;
|
|
376
|
+
if (options.format !== undefined) {
|
|
377
|
+
if (options.format !== '7z' && options.format !== 'zip'
|
|
378
|
+
&& options.format !== 'tar' && options.format !== 'wim') {
|
|
379
|
+
throw new TypeError('Archive format must be "7z", "zip", "tar", or "wim"');
|
|
380
|
+
}
|
|
381
|
+
format = options.format;
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
const extension = node_path.extname(targetPath).toLowerCase();
|
|
385
|
+
if (extension === '.7z') {
|
|
386
|
+
format = '7z';
|
|
387
|
+
}
|
|
388
|
+
else if (extension === '.zip') {
|
|
389
|
+
format = 'zip';
|
|
390
|
+
}
|
|
391
|
+
else if (extension === '.tar') {
|
|
392
|
+
format = 'tar';
|
|
393
|
+
}
|
|
394
|
+
else if (extension === '.wim') {
|
|
395
|
+
format = 'wim';
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
throw new TypeError('Specify format as "7z", "zip", "tar", or "wim" for an unrecognized output extension');
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (options.compressionLevel !== undefined && format !== '7z' && format !== 'zip') {
|
|
402
|
+
throw new TypeError('compressionLevel is only supported for ZIP and 7z archives');
|
|
403
|
+
}
|
|
404
|
+
const normalizedEntries = await Promise.all(entries.map(normalizeCreateEntry));
|
|
405
|
+
const caseInsensitivePaths = process.platform === 'win32' || process.platform === 'darwin';
|
|
406
|
+
const pathKeys = normalizedEntries.map(entry => caseInsensitivePaths ? entry.path.toLowerCase() : entry.path);
|
|
407
|
+
const archivePaths = new Set(pathKeys);
|
|
408
|
+
if (archivePaths.size !== normalizedEntries.length) {
|
|
409
|
+
throw new ArchiveError('ERR_ARCHIVE_PATH', 'Archive creation paths must be unique');
|
|
410
|
+
}
|
|
411
|
+
for (const entry of normalizedEntries) {
|
|
412
|
+
const segments = entry.path.split('/');
|
|
413
|
+
for (let index = 1; index < segments.length; index++) {
|
|
414
|
+
const parent = segments.slice(0, index).join('/');
|
|
415
|
+
const parentKey = caseInsensitivePaths ? parent.toLowerCase() : parent;
|
|
416
|
+
if (archivePaths.has(parentKey)) {
|
|
417
|
+
throw new ArchiveError('ERR_ARCHIVE_PATH', `Archive creation file path is a parent of another entry: ${parent}`);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (options.overwrite) {
|
|
422
|
+
await assertReplaceableOutput(targetPath);
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
await assertOutputDoesNotExist(targetPath);
|
|
426
|
+
}
|
|
427
|
+
const temporaryPath = node_path.join(node_path.dirname(targetPath), `.7zip-native-${node_crypto.randomUUID()}.tmp`);
|
|
428
|
+
try {
|
|
429
|
+
await native.create(temporaryPath, format, normalizedEntries, compressionLevel, enginePath);
|
|
430
|
+
if (options.overwrite) {
|
|
431
|
+
await assertReplaceableOutput(targetPath);
|
|
432
|
+
await promises.rename(temporaryPath, targetPath);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
await promises.link(temporaryPath, targetPath);
|
|
436
|
+
await promises.rm(temporaryPath);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
catch (cause) {
|
|
440
|
+
await promises.rm(temporaryPath, { force: true });
|
|
441
|
+
if (cause instanceof ArchiveError) {
|
|
442
|
+
throw cause;
|
|
443
|
+
}
|
|
444
|
+
throw new ArchiveError('ERR_ARCHIVE_CREATE', errorMessage(cause), { cause });
|
|
445
|
+
}
|
|
446
|
+
}
|
|
302
447
|
async entries() {
|
|
303
448
|
this.assertOpen();
|
|
304
449
|
this.entriesPromise ??= native.entries(this.handle).catch((cause) => {
|
|
@@ -369,7 +514,7 @@ class Archive {
|
|
|
369
514
|
if (!destination || typeof destination.write !== 'function') {
|
|
370
515
|
throw new TypeError('Destination must be a writable stream');
|
|
371
516
|
}
|
|
372
|
-
await promises.pipeline(this.createReadStream(idOrPath, options), destination, { signal: options.signal });
|
|
517
|
+
await promises$1.pipeline(this.createReadStream(idOrPath, options), destination, { signal: options.signal });
|
|
373
518
|
}
|
|
374
519
|
async extractToFolder(destination, options = {}) {
|
|
375
520
|
this.assertOpen();
|
|
@@ -382,9 +527,19 @@ class Archive {
|
|
|
382
527
|
if (options.overwrite !== undefined && typeof options.overwrite !== 'boolean') {
|
|
383
528
|
throw new TypeError('Folder extraction overwrite option must be a boolean');
|
|
384
529
|
}
|
|
530
|
+
if (options.concurrency !== undefined
|
|
531
|
+
&& (!Number.isSafeInteger(options.concurrency)
|
|
532
|
+
|| options.concurrency < 1
|
|
533
|
+
|| options.concurrency > 128)) {
|
|
534
|
+
throw new RangeError('Folder extraction concurrency must be an integer between 1 and 128');
|
|
535
|
+
}
|
|
385
536
|
if (options.onProgress !== undefined && typeof options.onProgress !== 'function') {
|
|
386
537
|
throw new TypeError('Folder extraction onProgress option must be a function');
|
|
387
538
|
}
|
|
539
|
+
if (options.onExtract !== undefined && typeof options.onExtract !== 'function') {
|
|
540
|
+
throw new TypeError('Folder extraction onExtract option must be a function');
|
|
541
|
+
}
|
|
542
|
+
const concurrency = Math.min(options.concurrency ?? 1, Archive.concurrency());
|
|
388
543
|
options.signal?.throwIfAborted();
|
|
389
544
|
const maxBytes = normalizeMaxBytes(options.maxBytes, 'maxBytes');
|
|
390
545
|
const entries = await this.entries();
|
|
@@ -454,8 +609,28 @@ class Archive {
|
|
|
454
609
|
options.signal?.throwIfAborted();
|
|
455
610
|
if (plan.isDirectory) {
|
|
456
611
|
await ensureOutputDirectoryTree(root, plan.targetPath);
|
|
457
|
-
continue;
|
|
458
612
|
}
|
|
613
|
+
}
|
|
614
|
+
const filePlans = plans.filter(plan => !plan.isDirectory);
|
|
615
|
+
const controller = new AbortController();
|
|
616
|
+
const extractionSignal = controller.signal;
|
|
617
|
+
let hasFailure = false;
|
|
618
|
+
let failure;
|
|
619
|
+
let nextFileIndex = 0;
|
|
620
|
+
const stop = (error) => {
|
|
621
|
+
if (!hasFailure) {
|
|
622
|
+
hasFailure = true;
|
|
623
|
+
failure = error;
|
|
624
|
+
}
|
|
625
|
+
if (!extractionSignal.aborted) {
|
|
626
|
+
controller.abort(error);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
const abortFromCaller = () => {
|
|
630
|
+
stop(options.signal?.reason);
|
|
631
|
+
};
|
|
632
|
+
options.signal?.addEventListener('abort', abortFromCaller, { once: true });
|
|
633
|
+
const extractFile = async (plan) => {
|
|
459
634
|
await ensureOutputParents(root, plan.targetPath);
|
|
460
635
|
const limit = new node_stream.Transform({
|
|
461
636
|
transform(chunk, _encoding, callback) {
|
|
@@ -479,26 +654,59 @@ class Archive {
|
|
|
479
654
|
await assertReplaceableOutput(plan.targetPath);
|
|
480
655
|
const temporaryPath = node_path.join(node_path.dirname(plan.targetPath), `.7zip-native-${node_crypto.randomUUID()}.tmp`);
|
|
481
656
|
try {
|
|
482
|
-
await promises.pipeline(this.createReadStream(plan.entry.id, {
|
|
483
|
-
signal:
|
|
657
|
+
await promises$1.pipeline(this.createReadStream(plan.entry.id, {
|
|
658
|
+
signal: extractionSignal,
|
|
484
659
|
maxBytes: null,
|
|
485
|
-
}), limit, node_fs.createWriteStream(temporaryPath, { flags: 'wx', mode: 0o600 }), { signal:
|
|
660
|
+
}), limit, node_fs.createWriteStream(temporaryPath, { flags: 'wx', mode: 0o600 }), { signal: extractionSignal });
|
|
661
|
+
extractionSignal.throwIfAborted();
|
|
486
662
|
await assertReplaceableOutput(plan.targetPath);
|
|
487
|
-
|
|
663
|
+
extractionSignal.throwIfAborted();
|
|
664
|
+
await promises.rename(temporaryPath, plan.targetPath);
|
|
488
665
|
}
|
|
489
666
|
catch (error) {
|
|
490
|
-
await promises
|
|
667
|
+
await promises.rm(temporaryPath, { force: true });
|
|
491
668
|
throw error;
|
|
492
669
|
}
|
|
493
670
|
}
|
|
494
671
|
else {
|
|
495
|
-
await promises.pipeline(this.createReadStream(plan.entry.id, {
|
|
496
|
-
signal:
|
|
672
|
+
await promises$1.pipeline(this.createReadStream(plan.entry.id, {
|
|
673
|
+
signal: extractionSignal,
|
|
497
674
|
maxBytes: null,
|
|
498
|
-
}), limit, node_fs.createWriteStream(plan.targetPath, { flags: 'wx', mode: 0o600 }), { signal:
|
|
675
|
+
}), limit, node_fs.createWriteStream(plan.targetPath, { flags: 'wx', mode: 0o600 }), { signal: extractionSignal });
|
|
499
676
|
}
|
|
500
677
|
filesExtracted++;
|
|
501
678
|
reportProgress();
|
|
679
|
+
options.onExtract?.({ entry: plan.entry, outputPath: plan.targetPath });
|
|
680
|
+
};
|
|
681
|
+
const runWorker = async () => {
|
|
682
|
+
while (!hasFailure) {
|
|
683
|
+
if (options.signal?.aborted) {
|
|
684
|
+
stop(options.signal.reason);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
const plan = filePlans[nextFileIndex++];
|
|
688
|
+
if (!plan) {
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
try {
|
|
692
|
+
await extractFile(plan);
|
|
693
|
+
}
|
|
694
|
+
catch (error) {
|
|
695
|
+
stop(error);
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
try {
|
|
701
|
+
options.signal?.throwIfAborted();
|
|
702
|
+
const workers = Array.from({ length: Math.min(concurrency, filePlans.length) }, () => runWorker());
|
|
703
|
+
await Promise.all(workers);
|
|
704
|
+
if (hasFailure) {
|
|
705
|
+
throw failure;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
finally {
|
|
709
|
+
options.signal?.removeEventListener('abort', abortFromCaller);
|
|
502
710
|
}
|
|
503
711
|
}
|
|
504
712
|
async read(idOrPath, options) {
|
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,16 @@ interface ReadOptions {
|
|
|
19
19
|
interface OpenOptions {
|
|
20
20
|
readonly password?: string;
|
|
21
21
|
}
|
|
22
|
+
type ArchiveFormat = '7z' | 'zip' | 'tar' | 'wim';
|
|
23
|
+
interface ArchiveCreateEntry {
|
|
24
|
+
readonly sourcePath: string;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
}
|
|
27
|
+
interface CreateArchiveOptions {
|
|
28
|
+
readonly format?: ArchiveFormat;
|
|
29
|
+
readonly compressionLevel?: number;
|
|
30
|
+
readonly overwrite?: boolean;
|
|
31
|
+
}
|
|
22
32
|
interface ExtractToFolderProgress {
|
|
23
33
|
readonly filesExtracted: number;
|
|
24
34
|
readonly totalFiles: number;
|
|
@@ -26,6 +36,10 @@ interface ExtractToFolderProgress {
|
|
|
26
36
|
readonly totalBytes: bigint;
|
|
27
37
|
readonly percent: number;
|
|
28
38
|
}
|
|
39
|
+
interface ExtractedArchiveFile {
|
|
40
|
+
readonly entry: ArchiveEntry;
|
|
41
|
+
readonly outputPath: string;
|
|
42
|
+
}
|
|
29
43
|
interface ReadStreamOptions {
|
|
30
44
|
readonly highWaterMark?: number;
|
|
31
45
|
readonly maxBytes?: number | bigint | null;
|
|
@@ -34,12 +48,14 @@ interface ReadStreamOptions {
|
|
|
34
48
|
interface ExtractToFolderOptions {
|
|
35
49
|
readonly ids?: readonly EntryId[];
|
|
36
50
|
readonly paths?: readonly string[];
|
|
51
|
+
readonly concurrency?: number;
|
|
37
52
|
readonly overwrite?: boolean;
|
|
38
53
|
readonly onProgress?: (progress: ExtractToFolderProgress) => void;
|
|
54
|
+
readonly onExtract?: (result: ExtractedArchiveFile) => void;
|
|
39
55
|
readonly maxBytes?: number | bigint | null;
|
|
40
56
|
readonly signal?: AbortSignal;
|
|
41
57
|
}
|
|
42
|
-
type ArchiveErrorCode = 'ERR_ARCHIVE_CLOSED' | 'ERR_INVALID_ENTRY' | 'ERR_INVALID_RANGE' | 'ERR_RESOURCE_LIMIT' | 'ERR_ARCHIVE_OPEN' | 'ERR_ARCHIVE_PASSWORD' | 'ERR_ARCHIVE_PATH' | 'ERR_ARCHIVE_EXTRACT';
|
|
58
|
+
type ArchiveErrorCode = 'ERR_ARCHIVE_CLOSED' | 'ERR_INVALID_ENTRY' | 'ERR_INVALID_RANGE' | 'ERR_RESOURCE_LIMIT' | 'ERR_ARCHIVE_OPEN' | 'ERR_ARCHIVE_PASSWORD' | 'ERR_ARCHIVE_PATH' | 'ERR_ARCHIVE_EXTRACT' | 'ERR_ARCHIVE_CREATE';
|
|
43
59
|
declare class ArchiveError extends Error {
|
|
44
60
|
readonly code: ArchiveErrorCode;
|
|
45
61
|
constructor(code: ArchiveErrorCode, message: string, options?: ErrorOptions);
|
|
@@ -52,6 +68,7 @@ declare class Archive {
|
|
|
52
68
|
private constructor();
|
|
53
69
|
static concurrency(value?: number): number;
|
|
54
70
|
static open(path: string, options?: OpenOptions): Promise<Archive>;
|
|
71
|
+
static create(outputPath: string, entries: readonly ArchiveCreateEntry[], options?: CreateArchiveOptions): Promise<void>;
|
|
55
72
|
entries(): Promise<readonly ArchiveEntry[]>;
|
|
56
73
|
getEntry(idOrPath: EntrySelector): Promise<ArchiveEntry | undefined>;
|
|
57
74
|
extract(idOrPath: EntrySelector): Promise<Buffer>;
|
|
@@ -69,4 +86,4 @@ declare class Archive {
|
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
export { Archive, ArchiveError };
|
|
72
|
-
export type { ArchiveEntry, ArchiveErrorCode, EntryId, EntrySelector, ExtractToFolderOptions, ExtractToFolderProgress, OpenOptions, ReadOptions, ReadStreamOptions };
|
|
89
|
+
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions, ExtractToFolderProgress, ExtractedArchiveFile, OpenOptions, ReadOptions, ReadStreamOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,16 @@ interface ReadOptions {
|
|
|
19
19
|
interface OpenOptions {
|
|
20
20
|
readonly password?: string;
|
|
21
21
|
}
|
|
22
|
+
type ArchiveFormat = '7z' | 'zip' | 'tar' | 'wim';
|
|
23
|
+
interface ArchiveCreateEntry {
|
|
24
|
+
readonly sourcePath: string;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
}
|
|
27
|
+
interface CreateArchiveOptions {
|
|
28
|
+
readonly format?: ArchiveFormat;
|
|
29
|
+
readonly compressionLevel?: number;
|
|
30
|
+
readonly overwrite?: boolean;
|
|
31
|
+
}
|
|
22
32
|
interface ExtractToFolderProgress {
|
|
23
33
|
readonly filesExtracted: number;
|
|
24
34
|
readonly totalFiles: number;
|
|
@@ -26,6 +36,10 @@ interface ExtractToFolderProgress {
|
|
|
26
36
|
readonly totalBytes: bigint;
|
|
27
37
|
readonly percent: number;
|
|
28
38
|
}
|
|
39
|
+
interface ExtractedArchiveFile {
|
|
40
|
+
readonly entry: ArchiveEntry;
|
|
41
|
+
readonly outputPath: string;
|
|
42
|
+
}
|
|
29
43
|
interface ReadStreamOptions {
|
|
30
44
|
readonly highWaterMark?: number;
|
|
31
45
|
readonly maxBytes?: number | bigint | null;
|
|
@@ -34,12 +48,14 @@ interface ReadStreamOptions {
|
|
|
34
48
|
interface ExtractToFolderOptions {
|
|
35
49
|
readonly ids?: readonly EntryId[];
|
|
36
50
|
readonly paths?: readonly string[];
|
|
51
|
+
readonly concurrency?: number;
|
|
37
52
|
readonly overwrite?: boolean;
|
|
38
53
|
readonly onProgress?: (progress: ExtractToFolderProgress) => void;
|
|
54
|
+
readonly onExtract?: (result: ExtractedArchiveFile) => void;
|
|
39
55
|
readonly maxBytes?: number | bigint | null;
|
|
40
56
|
readonly signal?: AbortSignal;
|
|
41
57
|
}
|
|
42
|
-
type ArchiveErrorCode = 'ERR_ARCHIVE_CLOSED' | 'ERR_INVALID_ENTRY' | 'ERR_INVALID_RANGE' | 'ERR_RESOURCE_LIMIT' | 'ERR_ARCHIVE_OPEN' | 'ERR_ARCHIVE_PASSWORD' | 'ERR_ARCHIVE_PATH' | 'ERR_ARCHIVE_EXTRACT';
|
|
58
|
+
type ArchiveErrorCode = 'ERR_ARCHIVE_CLOSED' | 'ERR_INVALID_ENTRY' | 'ERR_INVALID_RANGE' | 'ERR_RESOURCE_LIMIT' | 'ERR_ARCHIVE_OPEN' | 'ERR_ARCHIVE_PASSWORD' | 'ERR_ARCHIVE_PATH' | 'ERR_ARCHIVE_EXTRACT' | 'ERR_ARCHIVE_CREATE';
|
|
43
59
|
declare class ArchiveError extends Error {
|
|
44
60
|
readonly code: ArchiveErrorCode;
|
|
45
61
|
constructor(code: ArchiveErrorCode, message: string, options?: ErrorOptions);
|
|
@@ -52,6 +68,7 @@ declare class Archive {
|
|
|
52
68
|
private constructor();
|
|
53
69
|
static concurrency(value?: number): number;
|
|
54
70
|
static open(path: string, options?: OpenOptions): Promise<Archive>;
|
|
71
|
+
static create(outputPath: string, entries: readonly ArchiveCreateEntry[], options?: CreateArchiveOptions): Promise<void>;
|
|
55
72
|
entries(): Promise<readonly ArchiveEntry[]>;
|
|
56
73
|
getEntry(idOrPath: EntrySelector): Promise<ArchiveEntry | undefined>;
|
|
57
74
|
extract(idOrPath: EntrySelector): Promise<Buffer>;
|
|
@@ -69,4 +86,4 @@ declare class Archive {
|
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
export { Archive, ArchiveError };
|
|
72
|
-
export type { ArchiveEntry, ArchiveErrorCode, EntryId, EntrySelector, ExtractToFolderOptions, ExtractToFolderProgress, OpenOptions, ReadOptions, ReadStreamOptions };
|
|
89
|
+
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions, ExtractToFolderProgress, ExtractedArchiveFile, OpenOptions, ReadOptions, ReadStreamOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,16 @@ interface ReadOptions {
|
|
|
19
19
|
interface OpenOptions {
|
|
20
20
|
readonly password?: string;
|
|
21
21
|
}
|
|
22
|
+
type ArchiveFormat = '7z' | 'zip' | 'tar' | 'wim';
|
|
23
|
+
interface ArchiveCreateEntry {
|
|
24
|
+
readonly sourcePath: string;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
}
|
|
27
|
+
interface CreateArchiveOptions {
|
|
28
|
+
readonly format?: ArchiveFormat;
|
|
29
|
+
readonly compressionLevel?: number;
|
|
30
|
+
readonly overwrite?: boolean;
|
|
31
|
+
}
|
|
22
32
|
interface ExtractToFolderProgress {
|
|
23
33
|
readonly filesExtracted: number;
|
|
24
34
|
readonly totalFiles: number;
|
|
@@ -26,6 +36,10 @@ interface ExtractToFolderProgress {
|
|
|
26
36
|
readonly totalBytes: bigint;
|
|
27
37
|
readonly percent: number;
|
|
28
38
|
}
|
|
39
|
+
interface ExtractedArchiveFile {
|
|
40
|
+
readonly entry: ArchiveEntry;
|
|
41
|
+
readonly outputPath: string;
|
|
42
|
+
}
|
|
29
43
|
interface ReadStreamOptions {
|
|
30
44
|
readonly highWaterMark?: number;
|
|
31
45
|
readonly maxBytes?: number | bigint | null;
|
|
@@ -34,12 +48,14 @@ interface ReadStreamOptions {
|
|
|
34
48
|
interface ExtractToFolderOptions {
|
|
35
49
|
readonly ids?: readonly EntryId[];
|
|
36
50
|
readonly paths?: readonly string[];
|
|
51
|
+
readonly concurrency?: number;
|
|
37
52
|
readonly overwrite?: boolean;
|
|
38
53
|
readonly onProgress?: (progress: ExtractToFolderProgress) => void;
|
|
54
|
+
readonly onExtract?: (result: ExtractedArchiveFile) => void;
|
|
39
55
|
readonly maxBytes?: number | bigint | null;
|
|
40
56
|
readonly signal?: AbortSignal;
|
|
41
57
|
}
|
|
42
|
-
type ArchiveErrorCode = 'ERR_ARCHIVE_CLOSED' | 'ERR_INVALID_ENTRY' | 'ERR_INVALID_RANGE' | 'ERR_RESOURCE_LIMIT' | 'ERR_ARCHIVE_OPEN' | 'ERR_ARCHIVE_PASSWORD' | 'ERR_ARCHIVE_PATH' | 'ERR_ARCHIVE_EXTRACT';
|
|
58
|
+
type ArchiveErrorCode = 'ERR_ARCHIVE_CLOSED' | 'ERR_INVALID_ENTRY' | 'ERR_INVALID_RANGE' | 'ERR_RESOURCE_LIMIT' | 'ERR_ARCHIVE_OPEN' | 'ERR_ARCHIVE_PASSWORD' | 'ERR_ARCHIVE_PATH' | 'ERR_ARCHIVE_EXTRACT' | 'ERR_ARCHIVE_CREATE';
|
|
43
59
|
declare class ArchiveError extends Error {
|
|
44
60
|
readonly code: ArchiveErrorCode;
|
|
45
61
|
constructor(code: ArchiveErrorCode, message: string, options?: ErrorOptions);
|
|
@@ -52,6 +68,7 @@ declare class Archive {
|
|
|
52
68
|
private constructor();
|
|
53
69
|
static concurrency(value?: number): number;
|
|
54
70
|
static open(path: string, options?: OpenOptions): Promise<Archive>;
|
|
71
|
+
static create(outputPath: string, entries: readonly ArchiveCreateEntry[], options?: CreateArchiveOptions): Promise<void>;
|
|
55
72
|
entries(): Promise<readonly ArchiveEntry[]>;
|
|
56
73
|
getEntry(idOrPath: EntrySelector): Promise<ArchiveEntry | undefined>;
|
|
57
74
|
extract(idOrPath: EntrySelector): Promise<Buffer>;
|
|
@@ -69,4 +86,4 @@ declare class Archive {
|
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
export { Archive, ArchiveError };
|
|
72
|
-
export type { ArchiveEntry, ArchiveErrorCode, EntryId, EntrySelector, ExtractToFolderOptions, ExtractToFolderProgress, OpenOptions, ReadOptions, ReadStreamOptions };
|
|
89
|
+
export type { ArchiveCreateEntry, ArchiveEntry, ArchiveErrorCode, ArchiveFormat, CreateArchiveOptions, EntryId, EntrySelector, ExtractToFolderOptions, ExtractToFolderProgress, ExtractedArchiveFile, OpenOptions, ReadOptions, ReadStreamOptions };
|