@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS")
import kotlin.js.*
import org.khronos.webgl.*
import org.w3c.dom.*
import org.w3c.dom.events.*
import org.w3c.dom.parsing.*
import org.w3c.dom.svg.*
import org.w3c.dom.url.*
import org.w3c.fetch.*
import org.w3c.files.*
import org.w3c.notifications.*
import org.w3c.performance.*
import org.w3c.workers.*
import org.w3c.xhr.*
import JSZip.JSZipObject
import tsstdlib.PromiseConstructorLike
import JSZip.JSZipFileOptions
import JSZip.JSZipGeneratorOptions
import JSZip.JSZipLoadOptions
import JSZip.JSZipObjectOptions
import JSZip.`T$0`
external interface JSZipSupport {
var arraybuffer: Boolean
var uint8array: Boolean
var blob: Boolean
var nodebuffer: Boolean
}
external interface Metadata {
var percent: Number
var currentFile: String
}
typealias OnUpdateCallback = (metadata: Metadata) -> Unit
external interface InputByType {
var base64: String
var string: String
var text: String
var binarystring: String
var array: Array<Number>
var uint8array: Uint8Array
var arraybuffer: ArrayBuffer
var blob: Blob
var stream: Any
}
external interface OutputByType {
var base64: String
var string: String
var text: String
var binarystring: String
var array: Array<Number>
var uint8array: Uint8Array
var arraybuffer: ArrayBuffer
var blob: Blob
var nodebuffer: Any
}
external interface `T$1` {
@nativeGetter
operator fun get(key: String): JSZipObject?
@nativeSetter
operator fun set(key: String, value: JSZipObject)
}
external interface `T$3` {
var Promise: PromiseConstructorLike
}
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
external interface JSZip {
var files: `T$1`
fun file(path: String): JSZipObject?
fun file(path: RegExp): Array<JSZipObject>
fun file(path: String, data: Any, options: JSZipFileOptions = definedExternally): JSZip /* this */
fun file(path: String, data: Any): JSZip /* this */
fun file(path: String, data: Promise<Any>, options: JSZipFileOptions = definedExternally): JSZip /* this */
fun file(path: String, data: Promise<Any>): JSZip /* this */
fun file(path: String, data: Nothing?, options: JSZipFileOptions /* JSZip.JSZipFileOptions & `T$2` */ = definedExternally): JSZip /* this */
fun file(path: String, data: Nothing?): JSZip /* this */
fun folder(name: String): JSZip?
fun folder(name: RegExp): Array<JSZipObject>
fun forEach(callback: (relativePath: String, file: JSZipObject) -> Unit)
fun filter(predicate: (relativePath: String, file: JSZipObject) -> Boolean): Array<JSZipObject>
fun remove(path: String): JSZip
fun <T : String> generateAsync(options: JSZipGeneratorOptions<T> = definedExternally, onUpdate: OnUpdateCallback = definedExternally): Promise<Any>
fun generateNodeStream(options: JSZipGeneratorOptions<String /* "nodebuffer" */> = definedExternally, onUpdate: OnUpdateCallback = definedExternally): NodeJS.ReadableStream
fun loadAsync(data: String, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: String): Promise<JSZip>
fun loadAsync(data: Array<Number>, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: Array<Number>): Promise<JSZip>
fun loadAsync(data: Uint8Array, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: Uint8Array): Promise<JSZip>
fun loadAsync(data: ArrayBuffer, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: ArrayBuffer): Promise<JSZip>
fun loadAsync(data: Blob, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: Blob): Promise<JSZip>
fun loadAsync(data: NodeJS.ReadableStream, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: NodeJS.ReadableStream): Promise<JSZip>
@nativeInvoke
operator fun invoke(): JSZip
var prototype: JSZip
var support: JSZipSupport
var external: `T$3`
var version: String
interface JSZipObject {
var name: String
var dir: Boolean
var date: Date
var comment: String
var unixPermissions: dynamic /* Number? | String? */
get() = definedExternally
set(value) = definedExternally
var dosPermissions: Number?
var options: JSZipObjectOptions
fun <T : String> async(type: T, onUpdate: OnUpdateCallback = definedExternally): Promise<Any>
fun nodeStream(type: String /* "nodebuffer" */ = definedExternally, onUpdate: OnUpdateCallback = definedExternally): NodeJS.ReadableStream
}
interface JSZipFileOptions {
var base64: Boolean?
get() = definedExternally
set(value) = definedExternally
var binary: Boolean?
get() = definedExternally
set(value) = definedExternally
var date: Date?
get() = definedExternally
set(value) = definedExternally
var compression: String?
get() = definedExternally
set(value) = definedExternally
var comment: String?
get() = definedExternally
set(value) = definedExternally
var optimizedBinaryString: Boolean?
get() = definedExternally
set(value) = definedExternally
var createFolders: Boolean?
get() = definedExternally
set(value) = definedExternally
var dir: Boolean?
get() = definedExternally
set(value) = definedExternally
var dosPermissions: Number?
get() = definedExternally
set(value) = definedExternally
var unixPermissions: dynamic /* Number? | String? */
get() = definedExternally
set(value) = definedExternally
}
interface JSZipObjectOptions {
var compression: String /* "STORE" | "DEFLATE" */
}
interface `T$0` {
var level: Number
}
interface JSZipGeneratorOptions<T : String> {
var compression: String? /* "STORE" | "DEFLATE" */
get() = definedExternally
set(value) = definedExternally
var compressionOptions: `T$0`?
get() = definedExternally
set(value) = definedExternally
var type: T?
get() = definedExternally
set(value) = definedExternally
var comment: String?
get() = definedExternally
set(value) = definedExternally
var mimeType: String?
get() = definedExternally
set(value) = definedExternally
val encodeFileName: ((filename: String) -> String)?
var streamFiles: Boolean?
get() = definedExternally
set(value) = definedExternally
var platform: String? /* "DOS" | "UNIX" */
get() = definedExternally
set(value) = definedExternally
}
interface JSZipLoadOptions {
var base64: Boolean?
get() = definedExternally
set(value) = definedExternally
var checkCRC32: Boolean?
get() = definedExternally
set(value) = definedExternally
var optimizedBinaryString: Boolean?
get() = definedExternally
set(value) = definedExternally
var createFolders: Boolean?
get() = definedExternally
set(value) = definedExternally
}
}
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
external interface JSZip {
var files: `T$1`
fun file(path: String): JSZipObject?
fun file(path: RegExp): Array<JSZipObject>
fun file(path: String, data: Any, options: JSZipFileOptions = definedExternally): JSZip /* this */
fun file(path: String, data: Any): JSZip /* this */
fun file(path: String, data: Promise<Any>, options: JSZipFileOptions = definedExternally): JSZip /* this */
fun file(path: String, data: Promise<Any>): JSZip /* this */
fun file(path: String, data: Nothing?, options: JSZipFileOptions /* JSZip.JSZipFileOptions & `T$2` */ = definedExternally): JSZip /* this */
fun file(path: String, data: Nothing?): JSZip /* this */
fun folder(name: String): JSZip?
fun folder(name: RegExp): Array<JSZipObject>
fun forEach(callback: (relativePath: String, file: JSZipObject) -> Unit)
fun filter(predicate: (relativePath: String, file: JSZipObject) -> Boolean): Array<JSZipObject>
fun remove(path: String): JSZip
fun <T : String> generateAsync(options: JSZipGeneratorOptions<T> = definedExternally, onUpdate: OnUpdateCallback = definedExternally): Promise<Any>
fun generateNodeStream(options: JSZipGeneratorOptions<String /* "nodebuffer" */> = definedExternally, onUpdate: OnUpdateCallback = definedExternally): NodeJS.ReadableStream
fun loadAsync(data: String, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: String): Promise<JSZip>
fun loadAsync(data: Array<Number>, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: Array<Number>): Promise<JSZip>
fun loadAsync(data: Uint8Array, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: Uint8Array): Promise<JSZip>
fun loadAsync(data: ArrayBuffer, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: ArrayBuffer): Promise<JSZip>
fun loadAsync(data: Blob, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: Blob): Promise<JSZip>
fun loadAsync(data: NodeJS.ReadableStream, options: JSZipLoadOptions = definedExternally): Promise<JSZip>
fun loadAsync(data: NodeJS.ReadableStream): Promise<JSZip>
@nativeInvoke
operator fun invoke(): JSZip
var prototype: JSZip
var support: JSZipSupport
var external: `T$3`
var version: String
interface JSZipObject {
var name: String
var dir: Boolean
var date: Date
var comment: String
var unixPermissions: dynamic /* Number? | String? */
get() = definedExternally
set(value) = definedExternally
var dosPermissions: Number?
var options: JSZipObjectOptions
fun <T : String> async(type: T, onUpdate: OnUpdateCallback = definedExternally): Promise<Any>
fun nodeStream(type: String /* "nodebuffer" */ = definedExternally, onUpdate: OnUpdateCallback = definedExternally): NodeJS.ReadableStream
}
interface JSZipFileOptions {
var base64: Boolean?
get() = definedExternally
set(value) = definedExternally
var binary: Boolean?
get() = definedExternally
set(value) = definedExternally
var date: Date?
get() = definedExternally
set(value) = definedExternally
var compression: String?
get() = definedExternally
set(value) = definedExternally
var comment: String?
get() = definedExternally
set(value) = definedExternally
var optimizedBinaryString: Boolean?
get() = definedExternally
set(value) = definedExternally
var createFolders: Boolean?
get() = definedExternally
set(value) = definedExternally
var dir: Boolean?
get() = definedExternally
set(value) = definedExternally
var dosPermissions: Number?
get() = definedExternally
set(value) = definedExternally
var unixPermissions: dynamic /* Number? | String? */
get() = definedExternally
set(value) = definedExternally
}
interface JSZipObjectOptions {
var compression: String /* "STORE" | "DEFLATE" */
}
interface `T$0` {
var level: Number
}
interface JSZipGeneratorOptions<T : String> {
var compression: String? /* "STORE" | "DEFLATE" */
get() = definedExternally
set(value) = definedExternally
var compressionOptions: `T$0`?
get() = definedExternally
set(value) = definedExternally
var type: T?
get() = definedExternally
set(value) = definedExternally
var comment: String?
get() = definedExternally
set(value) = definedExternally
var mimeType: String?
get() = definedExternally
set(value) = definedExternally
val encodeFileName: ((filename: String) -> String)?
var streamFiles: Boolean?
get() = definedExternally
set(value) = definedExternally
var platform: String? /* "DOS" | "UNIX" */
get() = definedExternally
set(value) = definedExternally
}
interface JSZipLoadOptions {
var base64: Boolean?
get() = definedExternally
set(value) = definedExternally
var checkCRC32: Boolean?
get() = definedExternally
set(value) = definedExternally
var optimizedBinaryString: Boolean?
get() = definedExternally
set(value) = definedExternally
var createFolders: Boolean?
get() = definedExternally
set(value) = definedExternally
}
}
Note how JSZip is generated twice. Also Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") is generated twice. The class also does not have a companion object so you cannot write val zip = JSZip()
Using dukat on jszip (https://github.com/Stuk/jszip/blob/master/index.d.ts) generates an invalid Kotlin file
Note how
JSZip
is generated twice. AlsoSuppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
is generated twice. The class also does not have a companion object so you cannot writeval zip = JSZip()