当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript zlib.gunzipSync函数代码示例

本文整理汇总了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;未经允许,请勿转载。