我想在Node.js中解压缩gzip文件我已经尝试了[某些]包,但没有任何工作.你能提供一个包含示例代码的软件包,它可以解压缩Node.js中的gzip文件吗?
gunzip-file 节点包工作正常!
做:
npm install gunzip-file
Run Code Online (Sandbox Code Playgroud)
然后:
'use strict'
const gunzip = require('gunzip-file')
// 'sitemap.xml.gz' - source file
// 'sitemap.xml' - destination file
// () => { ... } - notification callback
gunzip('sitemap.xml.gz', 'sitemap.xml', () => {
console.log('gunzip done!')
})
Run Code Online (Sandbox Code Playgroud)
最后,在shell上运行Node.