diff --git a/types/unzipper/index.d.ts b/types/unzipper/index.d.ts
index 43c50e1818..4e5b641eed 100644
--- a/types/unzipper/index.d.ts
+++ b/types/unzipper/index.d.ts
@@ -7,7 +7,7 @@
// TypeScript Version: 2.2
///
-import { Readable, Stream, PassThrough, Duplex } from "stream";
+import { Readable, Stream, PassThrough, Duplex, Transform } from "stream";
import { ClientRequest, RequestOptions } from "http";
export interface PullStream extends Duplex {
@@ -16,7 +16,9 @@ export interface PullStream extends Duplex {
}
export interface Entry extends PassThrough {
- autodrain(): Promise;
+ autodrain(): Transform & {
+ promise(): Promise;
+ };
buffer(): Promise;
path: string;
diff --git a/types/unzipper/unzipper-tests.ts b/types/unzipper/unzipper-tests.ts
index 26cebebdef..68464d5451 100644
--- a/types/unzipper/unzipper-tests.ts
+++ b/types/unzipper/unzipper-tests.ts
@@ -1,8 +1,14 @@
-import { Parse, Open, Entry, CentralDirectory } from "unzipper";
+import { createReadStream } from 'fs';
+import { get } from 'http';
+import { CentralDirectory, Entry, Open, Parse } 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.autodrain().promise().then(() => {
+ console.log("Finished draining stream");
+ });
+ });
createReadStream("http://example.org/path/to/archive.zip")
.pipe(Parse())