Files
DefinitelyTyped/types/archiver/index.d.ts
Dolan 1ee58c5114 Archiver update from 0.15.0 to 1.3.x (#15894)
* archiver clean up and updated version

* added tslint.json

* added back in create because it still works. Updated examples

* fixed listing issues

* fixed more linting issues

* added glob options and EntryData

* added more to tests

* fixed tests by returning this, instead of void

* removed whitespace

* Add node types import

* Keep original author
2017-05-01 17:08:44 -07:00

68 lines
2.0 KiB
TypeScript

// Type definitions for archiver 1.3
// Project: https://github.com/archiverjs/node-archiver
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>, Dolan Miu <https://github.com/dolanmiu>
// 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';
import * as express from 'express';
import * as glob from 'glob';
declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver;
declare namespace archiver {
type Format = 'zip' | 'tar';
function create(format: string, options?: ArchiverOptions): Archiver;
function registerFormat(format: string, module: Function): void;
interface EntryData {
name?: string;
prefix?: string;
stats?: string;
}
interface Archiver extends stream.Transform {
abort(): this;
append(source: stream.Readable | Buffer | string, name?: EntryData): this;
bulk(mappings: any): this;
directory(dirpath: string, options: EntryData | string, data?: EntryData): this;
file(filename: string, data: EntryData): this;
glob(pattern: string, options?: glob.IOptions, data?: EntryData): this;
finalize(): this;
pipe(stream: fs.WriteStream | express.Response): void;
setFormat(format: string): this;
setModule(module: Function): this;
pointer(): number;
use(plugin: Function): this;
}
interface ArchiverOptions {
store?: boolean;
gzip?: boolean;
gzipOptions?: {
level: number,
};
}
}
export = archiver;