繁体   English   中英

使用 node.js 在 S3 上提取 7z 文件

[英]extract 7z file on S3 using node.js

有人可以建议 npm package 为 node.js 提取 7z 文件。

我可以看到一些 npm package 可用于 ZIP 文件,但这不适用于 7Z 文件。

我基本上是想在 S3 上提取 7z 密码保护文件并从 7z 文件中读取数据。

试试node-7z package:

npm i node-7z
import Seven from 'node-7z'

// myStream is a Readable stream
const myStream = Seven.extractFull('./archive.7z', './output/dir/', {
  $progress: true
})

myStream.on('data', function (data) {
  doStuffWith(data) //? { status: 'extracted', file: 'extracted/file.txt" }
})

myStream.on('progress', function (progress) {
  doStuffWith(progress) //? { percent: 67, fileCount: 5, file: undefinded }
})

myStream.on('end', function () {
    // end of the operation, get the number of folders involved in the operation
  myStream.info.get('Folders') //? '4'
})

myStream.on('error', (err) => handleError(err))

它还支持您请求伴侣的密码功能。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM