• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TypeScript zlib.gunzipSync函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中zlib.gunzipSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript gunzipSync函数的具体用法?TypeScript gunzipSync怎么用?TypeScript gunzipSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了gunzipSync函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1:

    var r = fs.createReadStream('file.txt');
    var z = zlib.createGzip();
    var w = fs.createWriteStream('file.txt.gz');
    r.pipe(z).pipe(w);
    r.close();
}


////////////////////////////////////////////////////
/// zlib tests : http://nodejs.org/api/zlib.html ///
////////////////////////////////////////////////////

namespace zlib_tests {
    {
        const gzipped = zlib.gzipSync('test');
        const unzipped = zlib.gunzipSync(gzipped.toString());
    }

    {
        const deflate = zlib.deflateSync('test');
        const inflate = zlib.inflateSync(deflate.toString());
    }
}

////////////////////////////////////////////////////////
/// Crypto tests : http://nodejs.org/api/crypto.html ///
////////////////////////////////////////////////////////

namespace crypto_tests {
    {
        var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex');
开发者ID:DenisCarriere,项目名称:DefinitelyTyped,代码行数:31,代码来源:node-tests.ts


示例2: read

/**
 * Read the contents from the compressed file.
 */
function read(filename: string) {
    let content = fs.readFileSync(filename);
    let jsonString = zlib.gunzipSync(content);
    return JSON.parse(jsonString);
}
开发者ID:TheLarkInn,项目名称:awesome-typescript-loader,代码行数:8,代码来源:cache.ts


示例3: uncompress

 public static uncompress(buffer: Buffer): Buffer {
     return zlib.gunzipSync(buffer);
 }
开发者ID:swanest,项目名称:micromessaging,代码行数:3,代码来源:Utils.ts


示例4: inflateBody

async function inflateBody(response: Response): Promise<string> {
  const buffer = await response.arrayBuffer()
  return zlib.gunzipSync(new DataView(buffer)).toString()
}
开发者ID:dianpeng,项目名称:fly,代码行数:4,代码来源:gzip.tests.ts


示例5: inflateRawSync

);
const inflatedRaw: Buffer = inflateRawSync(deflateRawSync(compressMe));
const inflatedRawString: Buffer = inflateRawSync(deflateRawSync(compressMeString));

// gzip

gzip(compressMe, (err: Error | null, result: Buffer) => gunzip(result, (err: Error | null, result: Buffer) => result));
gzip(
    compressMe,
    { finishFlush: constants.Z_SYNC_FLUSH },
    (err: Error | null, result: Buffer) => gunzip(
        result, { finishFlush: constants.Z_SYNC_FLUSH },
        (err: Error | null, result: Buffer) => result
    )
);
const gunzipped: Buffer = gunzipSync(gzipSync(compressMe));

unzip(compressMe, (err: Error | null, result: Buffer) => result);
unzip(compressMe, { finishFlush: constants.Z_SYNC_FLUSH }, (err: Error | null, result: Buffer) => result);
const unzipped: Buffer = unzipSync(compressMe);

const bOpts: BrotliOptions = {
    chunkSize: 123,
    flush: 123123,
    params: {
        [constants.BROTLI_PARAM_LARGE_WINDOW]: true,
        [constants.BROTLI_PARAM_NPOSTFIX]: 123,
    },
    finishFlush: 123123,
};
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:30,代码来源:zlib.ts


示例6: require

var TestModule = require("./TestModule");
var zlib = require('zlib');
var pgp = require('pg-promise')();
var cn = {
    host: 'localhost',
    port: 5432,
    database: 'Test',
    user: 'postgres',
    password: 'postgres'
};
var db = pgp(cn);
var qrm = pgp.queryResult;
const dataPath = "./Data/data.txt.gz";

var buffer = fs.readFileSync(dataPath);
TestModule.init(zlib.gunzipSync(buffer));

var startCase = 1;
var endCase = 5000;
var i = startCase;
var totalSuccess = 0;
var totalFail = 0;
var minSuccess = 100;
var maxSuccess = 0;

function testRun() {
    db.query("SELECT * FROM \"Cases\" WHERE \"CaseSetId\" = ${caseSetId}", {
        caseSetId: i
    }, qrm.many).then((tests) => {
        i++;
        if(i <= endCase) {
开发者ID:Dyas,项目名称:challenge_word_classifier,代码行数:31,代码来源:Main.ts



注:本文中的zlib.gunzipSync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript zlib.gzip函数代码示例发布时间:2022-05-25
下一篇:
TypeScript zlib.gunzip函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap