【问题标题】:extract 7z file on S3 using node.js使用 node.js 在 S3 上提取 7z 文件
【发布时间】:2022-02-24 18:03:20
【问题描述】:

有人可以建议为 node.js 提取 7z 文件的 npm 包吗?

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

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

【问题讨论】:

  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: node.js amazon-web-services amazon-s3 npm 7zip


【解决方案1】:

试试node-7z打包:

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))

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

【讨论】:

  • 关注这个包处理本地文件夹,但我希望在 AWS S3 存储桶上提取 7zfiles。
  • @AlpeshDhori,S3 不是块文件系统。它是一个对象存储。
  • Allan Chua,您提供的代码接受本地文件夹路径,而我正在寻找的是 AWS Lambda 上要提取到 S3 存储桶上的代码。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-10-23
  • 2021-12-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-08
  • 1970-01-01
相关资源
最近更新 更多