DefinitelyTyped/types/yazl/index.d.ts
阿林 3889492dec [@types/node] add destroyed property for Readable and Writable (#38237)
* [@types/node] add `destroyed` property for Readable and Writable

1. https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_destroyed
2. https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_writable_destroyed

* [@types/node] add test for readable.destroyed/writable.destroyed

1. Property 'destroyed' is missing in type 'WriteStream' but required in type 'Writable'
2. check `destroyed`

* fixed: replace Readable with ReadableStream
2019-09-25 16:04:49 -07:00

47 lines
1.3 KiB
TypeScript

// Type definitions for yazl 2.4
// Project: https://github.com/thejoshwolfe/yazl
// Definitions by: taoqf <https://github.com/taoqf>
// Sean Marvi Oliver Genabe <https://github.com/seangenabe>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import { Buffer } from 'buffer';
export interface Options {
mtime: Date;
mode: number;
compress: boolean;
forceZip64Format: boolean;
}
export interface ReadStreamOptions extends Options {
size: number;
}
export interface DirectoryOptions {
mtime: Date;
mode: number;
}
export interface EndOptions {
forceZip64Format: boolean;
}
export interface DosDateTime {
date: number;
time: number;
}
export class ZipFile {
addFile(realPath: string, metadataPath: string, options?: Partial<Options>): void;
outputStream: NodeJS.ReadableStream;
addReadStream(input: NodeJS.ReadableStream, metadataPath: string, options?: Partial<ReadStreamOptions>): void;
addBuffer(buffer: Buffer, metadataPath: string, options?: Partial<Options>): void;
end(options?: EndOptions, finalSizeCallback?: () => void): void;
addEmptyDirectory(metadataPath: string, options?: Partial<DirectoryOptions>): void;
dateToDosDateTime(jsDate: Date): DosDateTime;
}