當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript unzipper.Parse函數代碼示例

本文整理匯總了TypeScript中unzipper.Parse函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript Parse函數的具體用法?TypeScript Parse怎麽用?TypeScript Parse使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Parse函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: process

function process(response: express.Response, filePath: string) {
  let chapterPages = [] as shared.IApiChapter;
  fs.createReadStream(filePath)
    .pipe(unzipper.Parse())
    .on('close', () => response.send(chapterPages))
    .on('entry', (entry: unzipper.Entry) => {
      chapterPages.push(entry.path);
      entry.autodrain();
    });
}
開發者ID:Deathspike,項目名稱:mangarack,代碼行數:10,代碼來源:chapter.ts

示例2: process

function process(request: express.Request, response: express.Response, filePath: string) {
  fs.createReadStream(filePath)
    .pipe(unzipper.Parse())
    .on('close', () => {
      if (response.headersSent) return;
      response.sendStatus(404);
    })
    .on('entry', (entry: unzipper.Entry) => {
      if (entry.path !== request.params.pageName) return entry.autodrain();
      response.set('Content-Type', mime.getType(entry.path) || 'application/octet-stream');
      return entry.pipe(response);
    });
}
開發者ID:Deathspike,項目名稱:mangarack,代碼行數:13,代碼來源:page.ts

示例3: createReadStream

import { Parse, Open, Entry, CentralDirectory } from "unzipper";

import { createReadStream } from "fs";

import { get } from "http";

createReadStream("http://example.org/path/to/archive.zip")
    .pipe(Parse())
    .on("entry", (entry: Entry) => {
        entry.buffer().then((b1: Buffer) => {});
        const s1: string = entry.path;
        const s2: string = entry.type;
        const o1: {
            signature?: number;
            versionsNeededToExtract: number;
            flags: number;
            compressionMethod: number;
            lastModifiedTime: number;
            crc32: number;
            compressedSize: number;
            fileNameLength: number;
            extraFieldLength: number;
        } =
            entry.vars;

        const o2: {
            signature: number;
            partsize: number;
            uncompressedSize: number;
            compressedSize: number;
            offset: number;
開發者ID:karimmarczak,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:unzipper-tests.ts

示例4: createReadStream

import {
	Parse,
	Open,
	Entry,
	CentralDirectory
} from 'unzipper';

import { createReadStream } from 'fs';

import { get } from 'http';

createReadStream(
	'http://example.org/path/to/archive.zip'
).pipe(
	Parse()
).on('entry', (entry: Entry) => {
	entry.buffer.then((b1: Buffer) => {});
	const s1: string = entry.path;
	const s2: string = entry.type;
	const o1: {
		signature?: number;
		versionsNeededToExtract: number;
		flags: number;
		compressionMethod: number;
		lastModifiedTime: number;
		crc32: number;
		compressedSize: number;
		fileNameLength: number;
		extraFieldLength: number;
	} = entry.vars;
開發者ID:Dru89,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:unzipper-tests.ts


注:本文中的unzipper.Parse函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。