大型 ZIPs 文件查看 node-stream-zip

码农软件 · 软件分类 · Node.js 扩展 · 2019-04-14 10:28:08

软件介绍

node-stream-zip 是查看和提取大型 ZIP 文件的 Node.js 库。

特性:

  • 从不加载完整的归档到内存,一切都是通过块读取

  • 大型归档支持

  • 所有操作都是非阻塞,非同步 i/o

  • 快速初始化

  • 无依赖,无二进制组件

  • 内置 zlib 模块解压

  • deflate, deflate64, sfx, macosx/windows 内置归档

  • ZIP64 支持

安装

$ npm install node-stream-zip

使用

var StreamZip = require('node-stream-zip');  
var zip = new StreamZip({  
    file: 'archive.zip',  
    storeEntries: true    
});
zip.on('error', function(err) { /*handle*/ });
zip.on('ready', function() {
    console.log('Entries read: ' + zip.entriesCount);
    // stream to stdout
    zip.stream('node/benchmark/net/tcp-raw-c2s.js', function(err, stm) {
        stm.pipe(process.stdout);
    });
    // extract file
    zip.extract('node/benchmark/net/tcp-raw-c2s.js', './temp/', function(err) {
        console.log('Entry extracted');
    });
    // extract folder
    zip.extract('node/benchmark/', './temp/', function(err, count) {
        console.log('Extracted ' + count + ' entries');
    });
    // extract all
    zip.extract(null, './temp/', function(err, count) {
        console.log('Extracted ' + count + ' entries');
    });
    // read file as buffer in sync way
    var data = zip.entryDataSync('README.md');
});
zip.on('extract', function(entry, file) {
    console.log('Extracted ' + entry.name + ' to ' + file);
});
zip.on('entry', function(entry) {
    // called on load, when entry description has been read
    // you can already stream this entry, without waiting until all entry descriptions are read (suitable for very large archives) 
    console.log('Read entry ', entry.name);
});

本文地址:https://codercto.com/soft/d/3550.html

无处不在的算法

无处不在的算法

[德]贝特霍尔德·弗金、赫尔穆特·阿尔特 / 机械工业出版社 / 2018-1-1

本书以简单易懂的写作风格,通过解决现实世界常见的问题来介绍各种算法技术,揭示了算法的设计与分析思想。全书共有41章,分为四大部分,图文并茂,把各种算法的核心思想讲得浅显易懂。本书可作为高等院校算法相关课程的本科生教材,也可作为研究人员、专业技术人员的常备参考书。一起来看看 《无处不在的算法》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具