Socket
Socket
Sign inDemoInstall

@types/jszip

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/jszip - npm Package Compare versions

Comparing version 0.0.33 to 3.1.0

299

jszip/index.d.ts

@@ -1,8 +0,138 @@

// Type definitions for JSZip
// Type definitions for JSZip 3.1
// Project: http://stuk.github.com/jszip/
// Definitions by: mzeiher <https://github.com/mzeiher>
// Definitions by: mzeiher <https://github.com/mzeiher>, forabi <https://github.com/forabi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
interface JSZipSupport {
arraybuffer: boolean;
uint8array: boolean;
blob: boolean;
nodebuffer: boolean;
}
type Compression = 'STORE' | 'DEFLATE';
interface Metadata {
percent: number;
currentFile: string;
}
type OnUpdateCallback = (metadata: Metadata) => void;
interface InputByType {
base64: string;
string: string;
text: string;
binarystring: string;
array: number[];
unit8array: Uint8Array;
arraybuffer: ArrayBuffer;
blob: Blob;
}
interface OutputByType {
base64: string;
text: string;
binarystring: string;
array: number[];
unit8array: Uint8Array;
arraybuffer: ArrayBuffer;
blob: Blob;
nodebuffer: Buffer;
}
type InputFileFormat = InputByType[keyof InputByType] | NodeJS.ReadableStream;
declare namespace JSZip {
type InputType = keyof InputByType;
type OutputType = keyof OutputByType;
interface JSZipObject {
name: string;
dir: boolean;
date: Date;
comment: string;
/** The UNIX permissions of the file, if any. */
unixPermissions: number | string | null;
/** The UNIX permissions of the file, if any. */
dosPermissions: number | null;
options: JSZipObjectOptions;
/**
* Prepare the content in the asked type.
* @param {String} type the type of the result.
* @param {OnUpdateCallback} onUpdate a function to call on each internal update.
* @return Promise the promise of the result.
*/
async<T extends OutputType>(type: T, onUpdate?: OnUpdateCallback): Promise<OutputByType[T]>;
nodeStream(type?: 'nodestream', onUpdate?: OnUpdateCallback): NodeJS.ReadableStream;
}
interface JSZipFileOptions {
/** Set to `true` if the data is `base64` encoded. For example image data from a `<canvas>` element. Plain text and HTML do not need this option. */
base64?: boolean;
/** Set to `true` if the data should be treated as raw content, `false` if this is a text. If `base64` is used,
* this defaults to `true`, if the data is not a `string`, this will be set to `true`.
*/
binary?: boolean;
/**
* The last modification date, defaults to the current date.
*/
date?: Date;
compression?: string;
comment?: string;
/** Set to `true` if (and only if) the input is a "binary string" and has already been prepared with a `0xFF` mask. */
optimizedBinaryString?: boolean;
/** Set to `true` if folders in the file path should be automatically created, otherwise there will only be virtual folders that represent the path to the file. */
createFolders?: boolean;
/** Set to `true` if this is a directory and content should be ignored. */
dir?: boolean;
/** 6 bits number. The DOS permissions of the file, if any. */
dosPermissions?: number | null;
/**
* 16 bits number. The UNIX permissions of the file, if any.
* Also accepts a `string` representing the octal value: `"644"`, `"755"`, etc.
*/
unixPermissions?: number | string | null;
}
interface JSZipObjectOptions {
compression: Compression;
}
interface JSZipGeneratorOptions<T extends OutputType = OutputType> {
compression?: Compression;
compressionOptions?: null | {
level: number;
};
type?: T;
comment?: string;
/**
* mime-type for the generated file.
* Useful when you need to generate a file with a different extension, ie: “.ods”.
* @default 'application/zip'
*/
mimeType?: string;
encodeFileName?(filename: string): string;
/** Stream the files and create file descriptors */
streamFiles?: boolean;
/** DOS (default) or UNIX */
platform?: 'DOS' | 'UNIX';
}
interface JSZipLoadOptions {
base64?: boolean;
checkCRC32?: boolean;
optimizedBinaryString?: boolean;
createFolders?: boolean;
}
}
interface JSZip {
files: {[key: string]: JSZipObject};
files: {[key: string]: JSZip.JSZipObject};

@@ -15,3 +145,3 @@ /**

*/
file(path: string): JSZipObject;
file(path: string): JSZip.JSZipObject;

@@ -24,3 +154,3 @@ /**

*/
file(path: RegExp): JSZipObject[];
file(path: RegExp): JSZip.JSZipObject[];

@@ -31,10 +161,11 @@ /**

* @param path Relative path to file
* @param content Content of the file
* @param data Content of the file
* @param options Optional information about the file
* @return JSZip object
*/
file(path: string, data: any, options?: JSZipFileOptions): JSZip;
file<T extends JSZip.InputType>(path: string, data: InputByType[T] | Promise<InputByType[T]>, options?: JSZip.JSZipFileOptions): this;
file<T extends JSZip.InputType>(path: string, data: null, options?: JSZip.JSZipFileOptions & { dir: true }): this;
/**
* Return an new JSZip instance with the given folder as root
* Returns an new JSZip instance with the given folder as root
*

@@ -52,3 +183,3 @@ * @param name Name of the folder

*/
folder(name: RegExp): JSZipObject[];
folder(name: RegExp): JSZip.JSZipObject[];

@@ -60,6 +191,6 @@ /**

*/
forEach(callback: (relativePath: string, file: JSZipObject) => void): void;
forEach(callback: (relativePath: string, file: JSZip.JSZipObject) => void): void;
/**
* Get all files wchich match the given filter function
* Get all files which match the given filter function
*

@@ -69,3 +200,3 @@ * @param predicate Filter function

*/
filter(predicate: (relativePath: string, file: JSZipObject) => boolean): JSZipObject[];
filter(predicate: (relativePath: string, file: JSZip.JSZipObject) => boolean): JSZip.JSZipObject[];

@@ -81,22 +212,18 @@ /**

/**
* @deprecated since version 3.0
* @see {@link generateAsync}
* http://stuk.github.io/jszip/documentation/upgrade_guide.html
*/
generate(options?: JSZipGeneratorOptions): any;
/**
* Generates a new archive asynchronously
*
* @param options Optional options for the generator
* @param onUpdate The optional function called on each internal update with the metadata.
* @return The serialized archive
*/
generateAsync(options?: JSZipGeneratorOptions, onUpdate?: Function): Promise<any>;
generateAsync<T extends JSZip.OutputType>(options?: JSZip.JSZipGeneratorOptions<T>, onUpdate?: OnUpdateCallback): Promise<OutputByType[T]>;
/**
* @deprecated since version 3.0
* @see {@link loadAsync}
* http://stuk.github.io/jszip/documentation/upgrade_guide.html
* Generates a new archive asynchronously
*
* @param options Optional options for the generator
* @param onUpdate The optional function called on each internal update with the metadata.
* @return A Node.js `ReadableStream`
*/
load(): void;
generateNodeStream(options?: JSZip.JSZipGeneratorOptions<'nodebuffer'>, onUpdate?: OnUpdateCallback): NodeJS.ReadStream;

@@ -110,118 +237,10 @@ /**

*/
loadAsync(data: any, options?: JSZipLoadOptions): Promise<JSZip>;
}
loadAsync(data: InputFileFormat, options?: JSZip.JSZipLoadOptions): Promise<JSZip>;
type Serialization = ("string" | "text" | "base64" | "binarystring" | "uint8array" |
"arraybuffer" | "blob" | "nodebuffer");
interface JSZipObject {
name: string;
dir: boolean;
date: Date;
comment: string;
options: JSZipObjectOptions;
/**
* Prepare the content in the asked type.
* @param {String} type the type of the result.
* @param {Function} onUpdate a function to call on each internal update.
* @return Promise the promise of the result.
*/
async(type: Serialization, onUpdate?: Function): Promise<any>;
/**
* @deprecated since version 3.0
*/
asText(): void;
/**
* @deprecated since version 3.0
*/
asBinary(): void;
/**
* @deprecated since version 3.0
*/
asArrayBuffer(): void;
/**
* @deprecated since version 3.0
*/
asUint8Array(): void;
//asNodeBuffer(): void;
}
interface JSZipFileOptions {
base64?: boolean;
binary?: boolean;
date?: Date;
compression?: string;
comment?: string;
optimizedBinaryString?: boolean;
createFolders?: boolean;
dir?: boolean;
}
interface JSZipObjectOptions {
/** deprecated */
base64: boolean;
/** deprecated */
binary: boolean;
/** deprecated */
dir: boolean;
/** deprecated */
date: Date;
compression: string;
}
interface JSZipGeneratorOptions {
/** deprecated */
base64?: boolean;
/** DEFLATE or STORE */
compression?: string;
/** base64 (default), string, uint8array, arraybuffer, blob */
type?: string;
comment?: string;
/**
* mime-type for the generated file.
* Useful when you need to generate a file with a different extension, ie: “.ods”.
*/
mimeType?: string;
/** streaming uses less memory */
streamFiles?: boolean;
/** DOS (default) or UNIX */
platform?: string;
}
interface JSZipLoadOptions {
base64?: boolean;
checkCRC32?: boolean;
optimizedBinaryString?: boolean;
createFolders?: boolean;
}
interface JSZipSupport {
arraybuffer: boolean;
uint8array: boolean;
blob: boolean;
nodebuffer: boolean;
}
declare var JSZip: {
/**
* Create JSZip instance
*/
(): JSZip;
/**
* Create JSZip instance
* If no parameters given an empty zip archive will be created
*
* @param data Serialized zip archive
* @param options Description of the serialized zip archive
*/
(data: any, options?: JSZipLoadOptions): JSZip;
/**
* Create JSZip instance
*/
new (): JSZip;
/**
* Create JSZip instance
* If no parameters given an empty zip archive will be created

@@ -232,10 +251,16 @@ *

*/
new (data: any, options?: JSZipLoadOptions): JSZip;
new (data?: InputFileFormat, options?: JSZip.JSZipLoadOptions): this;
(): JSZip;
prototype: JSZip;
support: JSZipSupport;
external: {
Promise: PromiseConstructorLike;
};
version: string;
}
declare module "jszip" {
export = JSZip;
}
declare var JSZip: JSZip;
export = JSZip;
{
"name": "@types/jszip",
"version": "0.0.33",
"version": "3.1.0",
"description": "TypeScript definitions for JSZip",

@@ -9,3 +9,9 @@ "license": "MIT",

"name": "mzeiher",
"url": "https://github.com/mzeiher"
"url": "https://github.com/mzeiher",
"githubUsername": "mzeiher"
},
{
"name": "forabi",
"url": "https://github.com/forabi",
"githubUsername": "forabi"
}

@@ -19,6 +25,7 @@ ],

"scripts": {},
"dependencies": {},
"peerDependencies": {},
"typesPublisherContentHash": "1662aabea3b5b6b613519eb02c48d0886dac452a2d0ae1a8be95f18c326748fc",
"typeScriptVersion": "2.0"
"dependencies": {
"@types/node": "*"
},
"typesPublisherContentHash": "a8cce7801b04a28ab5351c1210b3c2d7a5eaa7c7428ee1d2103868bf97e4bfa5",
"typeScriptVersion": "2.3"
}

@@ -11,7 +11,7 @@ # Installation

Additional Details
* Last updated: Wed, 31 May 2017 23:34:31 GMT
* Dependencies: none
* Global values: JSZip
* Last updated: Fri, 22 Sep 2017 13:56:12 GMT
* Dependencies: node
* Global values: none
# Credits
These definitions were written by mzeiher <https://github.com/mzeiher>.
These definitions were written by mzeiher <https://github.com/mzeiher>, forabi <https://github.com/forabi>.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc