mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
I've included the interface Archiver in the namespace. Basically this makes it easier to pass around an archive as a function parameter when using the typedefinition files
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
// Type definitions for archiver v0.15.0
|
|
// Project: https://github.com/archiverjs/node-archiver
|
|
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/* =================== USAGE ===================
|
|
|
|
import Archiver = require('archiver);
|
|
var archiver = Archiver.create('zip');
|
|
archiver.pipe(FS.createWriteStream('xxx'));
|
|
archiver.append(FS.createReadStream('xxx'));
|
|
archiver.finalize();
|
|
|
|
=============================================== */
|
|
|
|
/// <reference types="node" />
|
|
|
|
import * as FS from 'fs';
|
|
import * as STREAM from 'stream';
|
|
|
|
|
|
declare function archiver(format: string, options?: archiver.Options): archiver.Archiver;
|
|
|
|
declare namespace archiver {
|
|
|
|
export function create(format: string, options?: Options): Archiver;
|
|
|
|
|
|
export interface nameInterface {
|
|
name?: string;
|
|
}
|
|
|
|
export interface Archiver extends STREAM.Transform {
|
|
pipe(writeStream: FS.WriteStream): void;
|
|
append(source: FS.ReadStream | Buffer | string, name: nameInterface): void;
|
|
|
|
directory(dirpath: string, destpath: nameInterface | string): void;
|
|
directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void;
|
|
|
|
bulk(mappings: any): void;
|
|
finalize(): void;
|
|
}
|
|
|
|
export interface Options {
|
|
|
|
}
|
|
}
|
|
|
|
export = archiver;
|