Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ interface CompressionOptions {
level: number;
}

interface Metadata {
percent: number;
currentFile: string | null;
}

type OnUpdateCallback = (metadata: Metadata) => void;

interface InputByType {
base64: string;
string: string;
Expand Down Expand Up @@ -71,6 +64,13 @@ declare namespace JSZip {

type OutputType = keyof OutputByType;

interface JSZipMetadata {
percent: number;
currentFile: string | null;
}

type OnUpdateCallback = (metadata: JSZipMetadata) => void;

interface JSZipObject {
name: string;
/**
Expand Down Expand Up @@ -170,11 +170,6 @@ declare namespace JSZip {
decodeFileName?: (bytes: string[] | Uint8Array | Buffer) => string;
}

interface JSZipMetadata {
percent: number;
currentFile: string;
}

type DataEventCallback<T> = (dataChunk: T, metadata: JSZipMetadata) => void
type EndEventCallback = () => void
type ErrorEventCallback = (error: Error) => void
Expand Down Expand Up @@ -287,7 +282,7 @@ interface JSZip {
* @param onUpdate The optional function called on each internal update with the metadata.
* @return The serialized archive
*/
generateAsync<T extends JSZip.OutputType>(options?: JSZip.JSZipGeneratorOptions<T>, onUpdate?: OnUpdateCallback): Promise<OutputByType[T]>;
generateAsync<T extends JSZip.OutputType>(options?: JSZip.JSZipGeneratorOptions<T>, onUpdate?: JSZip.OnUpdateCallback): Promise<OutputByType[T]>;

/**
* Generates a new archive asynchronously
Expand All @@ -296,7 +291,7 @@ interface JSZip {
* @param onUpdate The optional function called on each internal update with the metadata.
* @return A Node.js `ReadableStream`
*/
generateNodeStream(options?: JSZip.JSZipGeneratorOptions<'nodebuffer'>, onUpdate?: OnUpdateCallback): NodeJS.ReadableStream;
generateNodeStream(options?: JSZip.JSZipGeneratorOptions<'nodebuffer'>, onUpdate?: JSZip.OnUpdateCallback): NodeJS.ReadableStream;

/**
* Generates the complete zip file with the internal stream implementation
Expand Down