# zipdata **Repository Path**: daoio/zipdata ## Basic Information - **Project Name**: zipdata - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-22 - **Last Updated**: 2023-03-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 十分简单的gzip压缩模块 ### 安装 ```javascript npm i zipdata ``` ### 使用 压缩后的数据是Buffer类型。 ```javascript const zipdata = require('zipdata'); zipdata('./file.txt') .then(data => { //do something }).catch(err => { // handle error }); //在async声明的函数中,直接使用await. ;(async () => { try { let data = await zipdata('./a.js'); } catch (err) { //... } })(); ``` 使用第二个参数表示是否为数据: ```javascript //如果data是压缩的数据不是文件路径 zipdata(data, true) .then(zdata => { //... }) .catch(err => { //... }) ```