Merge remote-tracking branch 'origin/releases/v2' into update-v1.1.19-f5d217be

# Conflicts:
#	package-lock.json
#	package.json
This commit is contained in:
github-actions[bot]
2022-08-19 09:42:44 +00:00
1923 changed files with 215142 additions and 1633 deletions

21
node_modules/@types/adm-zip/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

16
node_modules/@types/adm-zip/README.md generated vendored Executable file
View File

@@ -0,0 +1,16 @@
# Installation
> `npm install --save @types/adm-zip`
# Summary
This package contains type definitions for adm-zip (https://github.com/cthackers/adm-zip).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/adm-zip.
### Additional Details
* Last updated: Fri, 01 Apr 2022 08:01:43 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written by [John Vilk](https://github.com/jvilk), [Abner Oliveira](https://github.com/abner), [BendingBender](https://github.com/BendingBender), [Matthew Sainsbury](https://github.com/mattsains), and [Lei Nelissen](https://github.com/LeiNelissen).

380
node_modules/@types/adm-zip/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,380 @@
// Type definitions for adm-zip 0.5
// Project: https://github.com/cthackers/adm-zip
// Definitions by: John Vilk <https://github.com/jvilk>
// Abner Oliveira <https://github.com/abner>
// BendingBender <https://github.com/BendingBender>
// Matthew Sainsbury <https://github.com/mattsains>
// Lei Nelissen <https://github.com/LeiNelissen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as FS from 'fs';
import { Constants } from './util';
declare class AdmZip {
/**
* @param fileNameOrRawData If provided, reads an existing archive. Otherwise creates a new, empty archive.
* @param options Options when initializing the ZIP file
*/
constructor(fileNameOrRawData?: string | Buffer, options?: Partial<AdmZip.InitOptions>);
/**
* Extracts the given entry from the archive and returns the content as a Buffer object
* @param entry ZipEntry object or String with the full path of the entry
* @param pass Password used for decrypting the file
* @return Buffer or Null in case of error
*/
readFile(entry: string | AdmZip.IZipEntry, pass?: string | Buffer): Buffer | null;
/**
* Asynchronous `readFile`.
* @param entry The full path of the entry or a `IZipEntry` object.
* @param callback Called with a `Buffer` or `null` in case of error.
*/
readFileAsync(entry: string | AdmZip.IZipEntry, callback: (data: Buffer | null, err: string) => void): void;
/**
* Extracts the given entry from the archive and returns the content as
* plain text in the given encoding.
* @param entry The full path of the entry or a `IZipEntry` object.
* @param encoding If no encoding is specified `"utf8"` is used.
*/
readAsText(fileName: string | AdmZip.IZipEntry, encoding?: string): string;
/**
* Asynchronous `readAsText`.
* @param entry The full path of the entry or a `IZipEntry` object.
* @param callback Called with the resulting string.
* @param encoding If no encoding is specified `"utf8"` is used.
*/
readAsTextAsync(
fileName: string | AdmZip.IZipEntry,
callback: (data: string, err: string) => void,
encoding?: string
): void;
/**
* Remove the entry from the file or the entry and all its nested directories
* and files if the given entry is a directory.
* @param entry The full path of the entry or a `IZipEntry` object.
*/
deleteFile(entry: string | AdmZip.IZipEntry): void;
/**
* Adds a comment to the zip. The zip must be rewritten after
* adding the comment.
* @param comment Content of the comment.
*/
addZipComment(comment: string): void;
/**
* @return The zip comment.
*/
getZipComment(): string;
/**
* Adds a comment to a specified file or `IZipEntry`. The zip must be rewritten after
* adding the comment.
* The comment cannot exceed 65535 characters in length.
* @param entry The full path of the entry or a `IZipEntry` object.
* @param comment The comment to add to the entry.
*/
addZipEntryComment(entry: string | AdmZip.IZipEntry, comment: string): void;
/**
* Returns the comment of the specified entry.
* @param entry The full path of the entry or a `IZipEntry` object.
* @return The comment of the specified entry.
*/
getZipEntryComment(entry: string | AdmZip.IZipEntry): string;
/**
* Updates the content of an existing entry inside the archive. The zip
* must be rewritten after updating the content.
* @param entry The full path of the entry or a `IZipEntry` object.
* @param content The entry's new contents.
*/
updateFile(entry: string | AdmZip.IZipEntry, content: Buffer): void;
/**
* Adds a file from the disk to the archive.
* @param localPath Path to a file on disk.
* @param zipPath Path to a directory in the archive. Defaults to the empty
* string.
* @param zipName Name for the file.
* @param comment Comment to be attached to the file
*/
addLocalFile(localPath: string, zipPath?: string, zipName?: string, comment?: string): void;
/**
* Adds a local directory and all its nested files and directories to the
* archive.
* @param localPath Path to a folder on disk.
* @param zipPath Path to a folder in the archive. Default: `""`.
* @param filter RegExp or Function if files match will be included.
*/
addLocalFolder(localPath: string, zipPath?: string, filter?: RegExp | ((filename: string) => boolean)): void;
/**
* Asynchronous addLocalFile
* @param localPath
* @param callback
* @param zipPath optional path inside zip
* @param filter optional RegExp or Function if files match will
* be included.
*/
addLocalFolderAsync(
localPath: string,
callback: (success?: boolean, err?: string) => void,
zipPath?: string,
filter?: RegExp | ((filename: string) => boolean)
): void;
/**
*
* @param localPath - path where files will be extracted
* @param props - optional properties
* @param props.zipPath - optional path inside zip
* @param props.filter - RegExp or Function if files match will be included.
*/
addLocalFolderPromise(
localPath: string,
props: { zipPath?: string, filter?: RegExp | ((filename: string) => boolean) }
): Promise<void>;
/**
* Allows you to create a entry (file or directory) in the zip file.
* If you want to create a directory the `entryName` must end in `"/"` and a `null`
* buffer should be provided.
* @param entryName Entry path.
* @param content Content to add to the entry; must be a 0-length buffer
* for a directory.
* @param comment Comment to add to the entry.
* @param attr Attribute to add to the entry.
*/
addFile(entryName: string, content: Buffer, comment?: string, attr?: number): void;
/**
* Returns an array of `IZipEntry` objects representing the files and folders
* inside the archive.
*/
getEntries(): AdmZip.IZipEntry[];
/**
* Returns a `IZipEntry` object representing the file or folder specified by `name`.
* @param name Name of the file or folder to retrieve.
* @return The entry corresponding to the `name`.
*/
getEntry(name: string): AdmZip.IZipEntry | null;
/**
* Returns the number of entries in the ZIP
* @return The amount of entries in the ZIP
*/
getEntryCount(): number;
/**
* Loop through each entry in the ZIP
* @param callback The callback that receives each individual entry
*/
forEach(callback: (entry: AdmZip.IZipEntry) => void): void;
/**
* Extracts the given entry to the given `targetPath`.
* If the entry is a directory inside the archive, the entire directory and
* its subdirectories will be extracted.
* @param entry The full path of the entry or a `IZipEntry` object.
* @param targetPath Target folder where to write the file.
* @param maintainEntryPath If maintainEntryPath is `true` and the entry is
* inside a folder, the entry folder will be created in `targetPath` as
* well. Default: `true`.
* @param overwrite If the file already exists at the target path, the file
* will be overwriten if this is `true`. Default: `false`.
* @param keepOriginalPermission The file will be set as the permission from
* the entry if this is true. Default: `false`.
* @param outFileName String If set will override the filename of the
* extracted file (Only works if the entry is a file)
* @return Boolean
*/
extractEntryTo(
entryPath: string | AdmZip.IZipEntry,
targetPath: string,
maintainEntryPath?: boolean,
overwrite?: boolean,
keepOriginalPermission?: boolean,
outFileName?: string,
): boolean;
/**
* Test the archive
* @param password The password for the archive
*/
test(password?: string | Buffer): boolean;
/**
* Extracts the entire archive to the given location.
* @param targetPath Target location.
* @param overwrite If the file already exists at the target path, the file
* will be overwriten if this is `true`. Default: `false`.
* @param keepOriginalPermission The file will be set as the permission from
* the entry if this is true. Default: `false`.
* @param password The password for the archive
*/
extractAllTo(
targetPath: string,
overwrite?: boolean,
keepOriginalPermission?: boolean,
password?: string | Buffer
): void;
/**
* Extracts the entire archive to the given location.
* @param targetPath Target location.
* @param overwrite If the file already exists at the target path, the file
* will be overwriten if this is `true`. Default: `false`.
* @param keepOriginalPermission The file will be set as the permission from
* the entry if this is true. Default: `false`.
* @param callback The callback function will be called after extraction.
*/
extractAllToAsync(
targetPath: string,
overwrite?: boolean,
keepOriginalPermission?: boolean,
callback?: (error?: Error) => void,
): void;
/**
* Writes the newly created zip file to disk at the specified location or
* if a zip was opened and no `targetFileName` is provided, it will
* overwrite the opened zip.
*/
writeZip(targetFileName?: string, callback?: (error: Error | null) => void): void;
/**
* Writes the newly created zip file to disk at the specified location or
* if a zip was opened and no `targetFileName` is provided, it will
* overwrite the opened zip.
*/
writeZipPromise(
targetFileName?: string,
props?: { overwrite?: boolean, perm?: number }
): Promise<boolean>;
/**
* Returns the content of the entire zip file.
*/
toBuffer(): Buffer;
/**
* Asynchronously returns the content of the entire zip file.
* @param onSuccess called with the content of the zip file, once it has been generated.
* @param onFail unused.
* @param onItemStart called before an entry is compressed.
* @param onItemEnd called after an entry is compressed.
*/
toBuffer(
onSuccess: (buffer: Buffer) => void,
onFail?: (...args: any[]) => void,
onItemStart?: (name: string) => void,
onItemEnd?: (name: string) => void,
): void;
/**
* Asynchronously convert the promise to a Buffer
*/
toBufferPromise(): Promise<Buffer>;
}
declare namespace AdmZip {
/**
* The `IZipEntry` is more than a structure representing the entry inside the
* zip file. Beside the normal attributes and headers a entry can have, the
* class contains a reference to the part of the file where the compressed
* data resides and decompresses it when requested. It also compresses the
* data and creates the headers required to write in the zip file.
*/
// disable warning about the I-prefix in interface name to prevent breaking stuff for users without a major bump
// tslint:disable-next-line:interface-name
interface IZipEntry {
/**
* Represents the full name and path of the file
*/
entryName: string;
readonly rawEntryName: Buffer;
/**
* Extra data associated with this entry.
*/
extra: Buffer;
/**
* Entry comment.
*/
comment: string;
readonly name: string;
/**
* Read-Only property that indicates the type of the entry.
*/
readonly isDirectory: boolean;
/**
* Get the header associated with this ZipEntry.
*/
readonly header: EntryHeader;
attr: number;
/**
* Retrieve the compressed data for this entry. Note that this may trigger
* compression if any properties were modified.
*/
getCompressedData(): Buffer;
/**
* Asynchronously retrieve the compressed data for this entry. Note that
* this may trigger compression if any properties were modified.
*/
getCompressedDataAsync(callback: (data: Buffer) => void): void;
/**
* Set the (uncompressed) data to be associated with this entry.
*/
setData(value: string | Buffer): void;
/**
* Get the decompressed data associated with this entry.
*/
getData(): Buffer;
/**
* Asynchronously get the decompressed data associated with this entry.
*/
getDataAsync(callback: (data: Buffer, err: string) => void): void;
/**
* Returns the CEN Entry Header to be written to the output zip file, plus
* the extra data and the entry comment.
*/
packHeader(): Buffer;
/**
* Returns a nicely formatted string with the most important properties of
* the ZipEntry.
*/
toString(): string;
}
interface EntryHeader {
made: number;
version: number;
flags: number;
method: number;
time: Date;
crc: number;
compressedSize: number;
size: number;
fileNameLength: number;
extraLength: number;
commentLength: number;
diskNumStart: number;
inAttr: number;
attr: number;
offset: number;
readonly encripted: boolean;
readonly entryHeaderSize: number;
readonly realDataOffset: number;
readonly dataHeader: DataHeader;
loadDataHeaderFromBinary(data: Buffer): void;
loadFromBinary(data: Buffer): void;
dataHeaderToBinary(): Buffer;
entryHeaderToBinary(): Buffer;
toString(): string;
}
interface DataHeader {
version: number;
flags: number;
method: number;
time: number;
crc: number;
compressedSize: number;
size: number;
fnameLen: number;
extraLen: number;
}
interface InitOptions {
/* If true it disables files sorting */
noSort: boolean;
/* Read entries during load (initial loading may be slower) */
readEntries: boolean;
/* Read method */
method: typeof Constants[keyof typeof Constants] | number;
/* file system */
fs: null | typeof FS;
}
}
export = AdmZip;

47
node_modules/@types/adm-zip/package.json generated vendored Executable file
View File

@@ -0,0 +1,47 @@
{
"name": "@types/adm-zip",
"version": "0.5.0",
"description": "TypeScript definitions for adm-zip",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/adm-zip",
"license": "MIT",
"contributors": [
{
"name": "John Vilk",
"url": "https://github.com/jvilk",
"githubUsername": "jvilk"
},
{
"name": "Abner Oliveira",
"url": "https://github.com/abner",
"githubUsername": "abner"
},
{
"name": "BendingBender",
"url": "https://github.com/BendingBender",
"githubUsername": "BendingBender"
},
{
"name": "Matthew Sainsbury",
"url": "https://github.com/mattsains",
"githubUsername": "mattsains"
},
{
"name": "Lei Nelissen",
"url": "https://github.com/LeiNelissen",
"githubUsername": "LeiNelissen"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/adm-zip"
},
"scripts": {},
"dependencies": {
"@types/node": "*"
},
"typesPublisherContentHash": "e7f9407982926b4743453eb7e13bc93b66f3e599200f0d101fe305016af41e50",
"typeScriptVersion": "3.9"
}

142
node_modules/@types/adm-zip/util.d.ts generated vendored Executable file
View File

@@ -0,0 +1,142 @@
export const Constants: {
/* The local file header */
LOCHDR: 30; // LOC header size
LOCSIG: 0x04034b50; // "PK\003\004"
LOCVER: 4; // version needed to extract
LOCFLG: 6; // general purpose bit flag
LOCHOW: 8; // compression method
LOCTIM: 10; // modification time (2 bytes time, 2 bytes date)
LOCCRC: 14; // uncompressed file crc-32 value
LOCSIZ: 18; // compressed size
LOCLEN: 22; // uncompressed size
LOCNAM: 26; // filename length
LOCEXT: 28; // extra field length
/* The Data descriptor */
EXTSIG: 0x08074b50; // "PK\007\008"
EXTHDR: 16; // EXT header size
EXTCRC: 4; // uncompressed file crc-32 value
EXTSIZ: 8; // compressed size
EXTLEN: 12; // uncompressed size
/* The central directory file header */
CENHDR: 46; // CEN header size
CENSIG: 0x02014b50; // "PK\001\002"
CENVEM: 4; // version made by
CENVER: 6; // version needed to extract
CENFLG: 8; // encrypt, decrypt flags
CENHOW: 10; // compression method
CENTIM: 12; // modification time (2 bytes time, 2 bytes date)
CENCRC: 16; // uncompressed file crc-32 value
CENSIZ: 20; // compressed size
CENLEN: 24; // uncompressed size
CENNAM: 28; // filename length
CENEXT: 30; // extra field length
CENCOM: 32; // file comment length
CENDSK: 34; // volume number start
CENATT: 36; // internal file attributes
CENATX: 38; // external file attributes (host system dependent)
CENOFF: 42; // LOC header offset
/* The entries in the end of central directory */
ENDHDR: 22; // END header size
ENDSIG: 0x06054b50; // "PK\005\006"
ENDSUB: 8; // number of entries on this disk
ENDTOT: 10; // total number of entries
ENDSIZ: 12; // central directory size in bytes
ENDOFF: 16; // offset of first CEN header
ENDCOM: 20; // zip file comment length
END64HDR: 20; // zip64 END header size
END64SIG: 0x07064b50; // zip64 Locator signature, "PK\006\007"
END64START: 4; // number of the disk with the start of the zip64
END64OFF: 8; // relative offset of the zip64 end of central directory
END64NUMDISKS: 16; // total number of disks
ZIP64SIG: 0x06064b50; // zip64 signature, "PK\006\006"
ZIP64HDR: 56; // zip64 record minimum size
ZIP64LEAD: 12; // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
ZIP64SIZE: 4; // zip64 size of the central directory record
ZIP64VEM: 12; // zip64 version made by
ZIP64VER: 14; // zip64 version needed to extract
ZIP64DSK: 16; // zip64 number of this disk
ZIP64DSKDIR: 20; // number of the disk with the start of the record directory
ZIP64SUB: 24; // number of entries on this disk
ZIP64TOT: 32; // total number of entries
ZIP64SIZB: 40; // zip64 central directory size in bytes
ZIP64OFF: 48; // offset of start of central directory with respect to the starting disk number
ZIP64EXTRA: 56; // extensible data sector
/* Compression methods */
STORED: 0; // no compression
SHRUNK: 1; // shrunk
REDUCED1: 2; // reduced with compression factor 1
REDUCED2: 3; // reduced with compression factor 2
REDUCED3: 4; // reduced with compression factor 3
REDUCED4: 5; // reduced with compression factor 4
IMPLODED: 6; // imploded
// 7 reserved for Tokenizing compression algorithm
DEFLATED: 8; // deflated
ENHANCED_DEFLATED: 9; // enhanced deflated
PKWARE: 10; // PKWare DCL imploded
// 11 reserved by PKWARE
BZIP2: 12; // compressed using BZIP2
// 13 reserved by PKWARE
LZMA: 14; // LZMA
// 15-17 reserved by PKWARE
IBM_TERSE: 18; // compressed using IBM TERSE
IBM_LZ77: 19; // IBM LZ77 z
AES_ENCRYPT: 99; // WinZIP AES encryption method
/* General purpose bit flag */
// values can obtained with expression 2**bitnr
FLG_ENC: 1; // Bit 0: encrypted file
FLG_COMP1: 2; // Bit 1, compression option
FLG_COMP2: 4; // Bit 2, compression option
FLG_DESC: 8; // Bit 3, data descriptor
FLG_ENH: 16; // Bit 4, enhanced deflating
FLG_PATCH: 32; // Bit 5, indicates that the file is compressed patched data.
FLG_STR: 64; // Bit 6, strong encryption (patented)
// Bits 7-10: Currently unused.
FLG_EFS: 2048; // Bit 11: Language encoding flag (EFS)
// Bit 12: Reserved by PKWARE for enhanced compression.
// Bit 13: encrypted the Central Directory (patented).
// Bits 14-15: Reserved by PKWARE.
FLG_MSK: 4096; // mask header values
/* Load type */
FILE: 2;
BUFFER: 1;
NONE: 0;
/* 4.5 Extensible data fields */
EF_ID: 0;
EF_SIZE: 2;
/* Header IDs */
ID_ZIP64: 0x0001;
ID_AVINFO: 0x0007;
ID_PFS: 0x0008;
ID_OS2: 0x0009;
ID_NTFS: 0x000a;
ID_OPENVMS: 0x000c;
ID_UNIX: 0x000d;
ID_FORK: 0x000e;
ID_PATCH: 0x000f;
ID_X509_PKCS7: 0x0014;
ID_X509_CERTID_F: 0x0015;
ID_X509_CERTID_C: 0x0016;
ID_STRONGENC: 0x0017;
ID_RECORD_MGT: 0x0018;
ID_X509_PKCS7_RL: 0x0019;
ID_IBM1: 0x0065;
ID_IBM2: 0x0066;
ID_POSZIP: 0x4690;
EF_ZIP64_OR_32: 0xffffffff;
EF_ZIP64_OR_16: 0xffff;
EF_ZIP64_SUNCOMP: 0;
EF_ZIP64_SCOMP: 8;
EF_ZIP64_RHO: 16;
EF_ZIP64_DSN: 24;
};

21
node_modules/@types/get-folder-size/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

16
node_modules/@types/get-folder-size/README.md generated vendored Normal file
View File

@@ -0,0 +1,16 @@
# Installation
> `npm install --save @types/get-folder-size`
# Summary
This package contains type definitions for get-folder-size (https://github.com/alessioalex/get-folder-size).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/get-folder-size
Additional Details
* Last updated: Fri, 06 Jul 2018 00:07:02 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by Mariusz Szczepańczyk <https://github.com/mszczepanczyk>.

9
node_modules/@types/get-folder-size/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for get-folder-size 2.0
// Project: https://github.com/alessioalex/get-folder-size
// Definitions by: Mariusz Szczepańczyk <https://github.com/mszczepanczyk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = getFolderSize;
declare function getFolderSize(folder: string, callback: (err: Error | null, size: number) => void): void;
declare function getFolderSize(folder: string, regexIgnorePattern: RegExp, callback: (err: Error | null, size: number) => void): void;

22
node_modules/@types/get-folder-size/package.json generated vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "@types/get-folder-size",
"version": "2.0.0",
"description": "TypeScript definitions for get-folder-size",
"license": "MIT",
"contributors": [
{
"name": "Mariusz Szczepańczyk",
"url": "https://github.com/mszczepanczyk",
"githubUsername": "mszczepanczyk"
}
],
"main": "",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "40dcdde6847f0332ef276f2d429f348945a3e481fb5cda7a3a89caf204b6f4f0",
"typeScriptVersion": "2.0"
}

42
node_modules/@types/long/LICENSE generated vendored Normal file → Executable file
View File

@@ -1,21 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

19
node_modules/@types/long/README.md generated vendored Normal file → Executable file
View File

@@ -1,16 +1,3 @@
# Installation
> `npm install --save @types/long`
# Summary
This package contains type definitions for long.js (https://github.com/dcodeIO/long.js).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/long.
### Additional Details
* Last updated: Wed, 22 Jan 2020 19:19:46 GMT
* Dependencies: none
* Global values: `Long`
# Credits
These definitions were written by Peter Kooijmans (https://github.com/peterkooijmans).
This is a stub types definition for @types/long (https://github.com/dcodeIO/long.js#readme).
long provides its own type definitions, so you don't need @types/long installed!

389
node_modules/@types/long/index.d.ts generated vendored
View File

@@ -1,389 +0,0 @@
// Type definitions for long.js 4.0.0
// Project: https://github.com/dcodeIO/long.js
// Definitions by: Peter Kooijmans <https://github.com/peterkooijmans>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions by: Denis Cappellin <https://github.com/cappellin>
export = Long;
export as namespace Long;
declare const Long: Long.LongConstructor;
type Long = Long.Long;
declare namespace Long {
interface LongConstructor {
/**
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
*/
new( low: number, high?: number, unsigned?: boolean ): Long;
prototype: Long;
/**
* Maximum unsigned value.
*/
MAX_UNSIGNED_VALUE: Long;
/**
* Maximum signed value.
*/
MAX_VALUE: Long;
/**
* Minimum signed value.
*/
MIN_VALUE: Long;
/**
* Signed negative one.
*/
NEG_ONE: Long;
/**
* Signed one.
*/
ONE: Long;
/**
* Unsigned one.
*/
UONE: Long;
/**
* Unsigned zero.
*/
UZERO: Long;
/**
* Signed zero
*/
ZERO: Long;
/**
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
*/
fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long;
/**
* Returns a Long representing the given 32 bit integer value.
*/
fromInt( value: number, unsigned?: boolean ): Long;
/**
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
*/
fromNumber( value: number, unsigned?: boolean ): Long;
/**
* Returns a Long representation of the given string, written using the specified radix.
*/
fromString( str: string, unsigned?: boolean | number, radix?: number ): Long;
/**
* Creates a Long from its byte representation.
*/
fromBytes( bytes: number[], unsigned?: boolean, le?: boolean ): Long;
/**
* Creates a Long from its little endian byte representation.
*/
fromBytesLE( bytes: number[], unsigned?: boolean ): Long;
/**
* Creates a Long from its little endian byte representation.
*/
fromBytesBE( bytes: number[], unsigned?: boolean ): Long;
/**
* Tests if the specified object is a Long.
*/
isLong( obj: any ): obj is Long;
/**
* Converts the specified value to a Long.
*/
fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long;
}
interface Long
{
/**
* The high 32 bits as a signed value.
*/
high: number;
/**
* The low 32 bits as a signed value.
*/
low: number;
/**
* Whether unsigned or not.
*/
unsigned: boolean;
/**
* Returns the sum of this and the specified Long.
*/
add( addend: number | Long | string ): Long;
/**
* Returns the bitwise AND of this Long and the specified.
*/
and( other: Long | number | string ): Long;
/**
* Compares this Long's value with the specified's.
*/
compare( other: Long | number | string ): number;
/**
* Compares this Long's value with the specified's.
*/
comp( other: Long | number | string ): number;
/**
* Returns this Long divided by the specified.
*/
divide( divisor: Long | number | string ): Long;
/**
* Returns this Long divided by the specified.
*/
div( divisor: Long | number | string ): Long;
/**
* Tests if this Long's value equals the specified's.
*/
equals( other: Long | number | string ): boolean;
/**
* Tests if this Long's value equals the specified's.
*/
eq( other: Long | number | string ): boolean;
/**
* Gets the high 32 bits as a signed integer.
*/
getHighBits(): number;
/**
* Gets the high 32 bits as an unsigned integer.
*/
getHighBitsUnsigned(): number;
/**
* Gets the low 32 bits as a signed integer.
*/
getLowBits(): number;
/**
* Gets the low 32 bits as an unsigned integer.
*/
getLowBitsUnsigned(): number;
/**
* Gets the number of bits needed to represent the absolute value of this Long.
*/
getNumBitsAbs(): number;
/**
* Tests if this Long's value is greater than the specified's.
*/
greaterThan( other: Long | number | string ): boolean;
/**
* Tests if this Long's value is greater than the specified's.
*/
gt( other: Long | number | string ): boolean;
/**
* Tests if this Long's value is greater than or equal the specified's.
*/
greaterThanOrEqual( other: Long | number | string ): boolean;
/**
* Tests if this Long's value is greater than or equal the specified's.
*/
gte( other: Long | number | string ): boolean;
/**
* Tests if this Long's value is even.
*/
isEven(): boolean;
/**
* Tests if this Long's value is negative.
*/
isNegative(): boolean;
/**
* Tests if this Long's value is odd.
*/
isOdd(): boolean;
/**
* Tests if this Long's value is positive.
*/
isPositive(): boolean;
/**
* Tests if this Long's value equals zero.
*/
isZero(): boolean;
/**
* Tests if this Long's value is less than the specified's.
*/
lessThan( other: Long | number | string ): boolean;
/**
* Tests if this Long's value is less than the specified's.
*/
lt( other: Long | number | string ): boolean;
/**
* Tests if this Long's value is less than or equal the specified's.
*/
lessThanOrEqual( other: Long | number | string ): boolean;
/**
* Tests if this Long's value is less than or equal the specified's.
*/
lte( other: Long | number | string ): boolean;
/**
* Returns this Long modulo the specified.
*/
modulo( other: Long | number | string ): Long;
/**
* Returns this Long modulo the specified.
*/
mod( other: Long | number | string ): Long;
/**
* Returns the product of this and the specified Long.
*/
multiply( multiplier: Long | number | string ): Long;
/**
* Returns the product of this and the specified Long.
*/
mul( multiplier: Long | number | string ): Long;
/**
* Negates this Long's value.
*/
negate(): Long;
/**
* Negates this Long's value.
*/
neg(): Long;
/**
* Returns the bitwise NOT of this Long.
*/
not(): Long;
/**
* Tests if this Long's value differs from the specified's.
*/
notEquals( other: Long | number | string ): boolean;
/**
* Tests if this Long's value differs from the specified's.
*/
neq( other: Long | number | string ): boolean;
/**
* Returns the bitwise OR of this Long and the specified.
*/
or( other: Long | number | string ): Long;
/**
* Returns this Long with bits shifted to the left by the given amount.
*/
shiftLeft( numBits: number | Long ): Long;
/**
* Returns this Long with bits shifted to the left by the given amount.
*/
shl( numBits: number | Long ): Long;
/**
* Returns this Long with bits arithmetically shifted to the right by the given amount.
*/
shiftRight( numBits: number | Long ): Long;
/**
* Returns this Long with bits arithmetically shifted to the right by the given amount.
*/
shr( numBits: number | Long ): Long;
/**
* Returns this Long with bits logically shifted to the right by the given amount.
*/
shiftRightUnsigned( numBits: number | Long ): Long;
/**
* Returns this Long with bits logically shifted to the right by the given amount.
*/
shru( numBits: number | Long ): Long;
/**
* Returns the difference of this and the specified Long.
*/
subtract( subtrahend: number | Long | string ): Long;
/**
* Returns the difference of this and the specified Long.
*/
sub( subtrahend: number | Long |string ): Long;
/**
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
*/
toInt(): number;
/**
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
*/
toNumber(): number;
/**
* Converts this Long to its byte representation.
*/
toBytes( le?: boolean ): number[];
/**
* Converts this Long to its little endian byte representation.
*/
toBytesLE(): number[];
/**
* Converts this Long to its big endian byte representation.
*/
toBytesBE(): number[];
/**
* Converts this Long to signed.
*/
toSigned(): Long;
/**
* Converts the Long to a string written in the specified radix.
*/
toString( radix?: number ): string;
/**
* Converts this Long to unsigned.
*/
toUnsigned(): Long;
/**
* Returns the bitwise XOR of this Long and the given one.
*/
xor( other: Long | number | string ): Long;
}
}

26
node_modules/@types/long/package.json generated vendored Normal file → Executable file
View File

@@ -1,24 +1,12 @@
{
"name": "@types/long",
"version": "4.0.1",
"description": "TypeScript definitions for long.js",
"license": "MIT",
"contributors": [
{
"name": "Peter Kooijmans",
"url": "https://github.com/peterkooijmans",
"githubUsername": "peterkooijmans"
}
],
"version": "5.0.0",
"description": "Stub TypeScript definitions entry for long, which provides its own types definitions",
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/long"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "5a2ae1424989c49d7303e1f5cc510288bfab1e71e0e2143cdcb9d24ff1c3dc8e",
"typeScriptVersion": "2.8"
"license": "MIT",
"dependencies": {
"long": "*"
},
"deprecated": "This is a stub types definition. long provides its own type definitions, so you do not need this installed."
}

21
node_modules/@types/node-fetch/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

16
node_modules/@types/node-fetch/README.md generated vendored Executable file
View File

@@ -0,0 +1,16 @@
# Installation
> `npm install --save @types/node-fetch`
# Summary
This package contains type definitions for node-fetch (https://github.com/bitinn/node-fetch).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch.
### Additional Details
* Last updated: Wed, 15 Jun 2022 20:31:35 GMT
* Dependencies: [@types/form-data](https://npmjs.com/package/@types/form-data), [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written by [Torsten Werner](https://github.com/torstenwerner), [Niklas Lindgren](https://github.com/nikcorg), [Vinay Bedre](https://github.com/vinaybedre), [Antonio Román](https://github.com/kyranet), [Andrew Leedham](https://github.com/AndrewLeedham), [Jason Li](https://github.com/JasonLi914), [Steve Faulkner](https://github.com/southpolesteve), [ExE Boss](https://github.com/ExE-Boss), [Alex Savin](https://github.com/alexandrusavin), [Alexis Tyler](https://github.com/OmgImAlexis), [Jakub Kisielewski](https://github.com/kbkk), and [David Glasser](https://github.com/glasser).

21
node_modules/@types/node-fetch/externals.d.ts generated vendored Executable file
View File

@@ -0,0 +1,21 @@
// `AbortSignal` is defined here to prevent a dependency on a particular
// implementation like the `abort-controller` package, and to avoid requiring
// the `dom` library in `tsconfig.json`.
export interface AbortSignal {
aborted: boolean;
addEventListener: (type: "abort", listener: ((this: AbortSignal, event: any) => any), options?: boolean | {
capture?: boolean | undefined,
once?: boolean | undefined,
passive?: boolean | undefined
}) => void;
removeEventListener: (type: "abort", listener: ((this: AbortSignal, event: any) => any), options?: boolean | {
capture?: boolean | undefined
}) => void;
dispatchEvent: (event: any) => boolean;
onabort: null | ((this: AbortSignal, event: any) => any);
}

224
node_modules/@types/node-fetch/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,224 @@
// Type definitions for node-fetch 2.6
// Project: https://github.com/bitinn/node-fetch
// Definitions by: Torsten Werner <https://github.com/torstenwerner>
// Niklas Lindgren <https://github.com/nikcorg>
// Vinay Bedre <https://github.com/vinaybedre>
// Antonio Román <https://github.com/kyranet>
// Andrew Leedham <https://github.com/AndrewLeedham>
// Jason Li <https://github.com/JasonLi914>
// Steve Faulkner <https://github.com/southpolesteve>
// ExE Boss <https://github.com/ExE-Boss>
// Alex Savin <https://github.com/alexandrusavin>
// Alexis Tyler <https://github.com/OmgImAlexis>
// Jakub Kisielewski <https://github.com/kbkk>
// David Glasser <https://github.com/glasser>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import FormData = require('form-data');
import { RequestOptions } from "http";
import { URLSearchParams, URL } from "url";
import { AbortSignal } from "./externals";
export class Request extends Body {
constructor(input: RequestInfo, init?: RequestInit);
clone(): Request;
context: RequestContext;
headers: Headers;
method: string;
redirect: RequestRedirect;
referrer: string;
url: string;
// node-fetch extensions to the whatwg/fetch spec
agent?: RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']);
compress: boolean;
counter: number;
follow: number;
hostname: string;
port?: number | undefined;
protocol: string;
size: number;
timeout: number;
}
export interface RequestInit {
// whatwg/fetch standard options
body?: BodyInit | undefined;
headers?: HeadersInit | undefined;
method?: string | undefined;
redirect?: RequestRedirect | undefined;
signal?: AbortSignal | null | undefined;
// node-fetch extensions
agent?: RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']); // =null http.Agent instance, allows custom proxy, certificate etc.
compress?: boolean | undefined; // =true support gzip/deflate content encoding. false to disable
follow?: number | undefined; // =20 maximum redirect count. 0 to not follow redirect
size?: number | undefined; // =0 maximum response body size in bytes. 0 to disable
timeout?: number | undefined; // =0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
// node-fetch does not support mode, cache or credentials options
}
export type RequestContext =
"audio"
| "beacon"
| "cspreport"
| "download"
| "embed"
| "eventsource"
| "favicon"
| "fetch"
| "font"
| "form"
| "frame"
| "hyperlink"
| "iframe"
| "image"
| "imageset"
| "import"
| "internal"
| "location"
| "manifest"
| "object"
| "ping"
| "plugin"
| "prefetch"
| "script"
| "serviceworker"
| "sharedworker"
| "style"
| "subresource"
| "track"
| "video"
| "worker"
| "xmlhttprequest"
| "xslt";
export type RequestMode = "cors" | "no-cors" | "same-origin";
export type RequestRedirect = "error" | "follow" | "manual";
export type RequestCredentials = "omit" | "include" | "same-origin";
export type RequestCache =
"default"
| "force-cache"
| "no-cache"
| "no-store"
| "only-if-cached"
| "reload";
export class Headers implements Iterable<[string, string]> {
constructor(init?: HeadersInit);
forEach(callback: (value: string, name: string) => void): void;
append(name: string, value: string): void;
delete(name: string): void;
get(name: string): string | null;
has(name: string): boolean;
raw(): { [k: string]: string[] };
set(name: string, value: string): void;
// Iterable methods
entries(): IterableIterator<[string, string]>;
keys(): IterableIterator<string>;
values(): IterableIterator<string>;
[Symbol.iterator](): Iterator<[string, string]>;
}
type BlobPart = ArrayBuffer | ArrayBufferView | Blob | string;
interface BlobOptions {
type?: string | undefined;
endings?: "transparent" | "native" | undefined;
}
export class Blob {
constructor(blobParts?: BlobPart[], options?: BlobOptions);
readonly type: string;
readonly size: number;
slice(start?: number, end?: number): Blob;
text(): Promise<string>;
}
export class Body {
constructor(body?: any, opts?: { size?: number | undefined; timeout?: number | undefined });
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
body: NodeJS.ReadableStream;
bodyUsed: boolean;
buffer(): Promise<Buffer>;
json(): Promise<any>;
size: number;
text(): Promise<string>;
textConverted(): Promise<string>;
timeout: number;
}
interface SystemError extends Error {
code?: string | undefined;
}
export class FetchError extends Error {
name: "FetchError";
constructor(message: string, type: string, systemError?: SystemError);
type: string;
code?: string | undefined;
errno?: string | undefined;
}
export class Response extends Body {
constructor(body?: BodyInit, init?: ResponseInit);
static error(): Response;
static redirect(url: string, status: number): Response;
clone(): Response;
headers: Headers;
ok: boolean;
redirected: boolean;
status: number;
statusText: string;
type: ResponseType;
url: string;
}
export type ResponseType =
"basic"
| "cors"
| "default"
| "error"
| "opaque"
| "opaqueredirect";
export interface ResponseInit {
headers?: HeadersInit | undefined;
size?: number | undefined;
status?: number | undefined;
statusText?: string | undefined;
timeout?: number | undefined;
url?: string | undefined;
}
interface URLLike {
href: string;
}
export type HeadersInit = Headers | string[][] | { [key: string]: string };
// HeaderInit is exported to support backwards compatibility. See PR #34382
export type HeaderInit = HeadersInit;
export type BodyInit =
ArrayBuffer
| ArrayBufferView
| NodeJS.ReadableStream
| string
| URLSearchParams
| FormData;
export type RequestInfo = string | URLLike | Request;
declare function fetch(
url: RequestInfo,
init?: RequestInit
): Promise<Response>;
declare namespace fetch {
function isRedirect(code: number): boolean;
}
export default fetch;

View File

@@ -0,0 +1,19 @@
Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,356 @@
# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data)
A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
[![Linux Build](https://img.shields.io/travis/form-data/form-data/v3.0.1.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data)
[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v3.0.1.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data)
[![Windows Build](https://img.shields.io/travis/form-data/form-data/v3.0.1.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data)
[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v3.0.1.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master)
[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)
## Install
```
npm install --save form-data
```
## Usage
In this example we are constructing a form with 3 fields that contain a string,
a buffer and a file stream.
``` javascript
var FormData = require('form-data');
var fs = require('fs');
var form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
```
Also you can use http-response stream:
``` javascript
var FormData = require('form-data');
var http = require('http');
var form = new FormData();
http.request('http://nodejs.org/images/logo.png', function(response) {
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_logo', response);
});
```
Or @mikeal's [request](https://github.com/request/request) stream:
``` javascript
var FormData = require('form-data');
var request = require('request');
var form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_logo', request('http://nodejs.org/images/logo.png'));
```
In order to submit this form to a web application, call ```submit(url, [callback])``` method:
``` javascript
form.submit('http://example.org/', function(err, res) {
// res response object (http.IncomingMessage) //
res.resume();
});
```
For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
### Custom options
You can provide custom options, such as `maxDataSize`:
``` javascript
var FormData = require('form-data');
var form = new FormData({ maxDataSize: 20971520 });
form.append('my_field', 'my value');
form.append('my_buffer', /* something big */);
```
List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15)
### Alternative submission methods
You can use node's http client interface:
``` javascript
var http = require('http');
var request = http.request({
method: 'post',
host: 'example.org',
path: '/upload',
headers: form.getHeaders()
});
form.pipe(request);
request.on('response', function(res) {
console.log(res.statusCode);
});
```
Or if you would prefer the `'Content-Length'` header to be set for you:
``` javascript
form.submit('example.org/upload', function(err, res) {
console.log(res.statusCode);
});
```
To use custom headers and pre-known length in parts:
``` javascript
var CRLF = '\r\n';
var form = new FormData();
var options = {
header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
knownLength: 1
};
form.append('my_buffer', buffer, options);
form.submit('http://example.com/', function(err, res) {
if (err) throw err;
console.log('Done');
});
```
Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
``` javascript
someModule.stream(function(err, stdout, stderr) {
if (err) throw err;
var form = new FormData();
form.append('file', stdout, {
filename: 'unicycle.jpg', // ... or:
filepath: 'photos/toys/unicycle.jpg',
contentType: 'image/jpeg',
knownLength: 19806
});
form.submit('http://example.com/', function(err, res) {
if (err) throw err;
console.log('Done');
});
});
```
The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory).
For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
``` javascript
form.submit({
host: 'example.com',
path: '/probably.php?extra=params',
auth: 'username:password'
}, function(err, res) {
console.log(res.statusCode);
});
```
In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
``` javascript
form.submit({
host: 'example.com',
path: '/surelynot.php',
headers: {'x-test-header': 'test-header-value'}
}, function(err, res) {
console.log(res.statusCode);
});
```
### Methods
- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-).
- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-)
- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary)
- [_Void_ setBoundary()](https://github.com/form-data/form-data#void-setboundary)
- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer)
- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync)
- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-)
- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength)
- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-)
- [_String_ toString()](https://github.com/form-data/form-data#string-tostring)
#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )
Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user.
```javascript
var form = new FormData();
form.append( 'my_string', 'my value' );
form.append( 'my_integer', 1 );
form.append( 'my_boolean', true );
form.append( 'my_buffer', new Buffer(10) );
form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) )
```
You may provide a string for options, or an object.
```javascript
// Set filename by providing a string for options
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' );
// provide an object.
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} );
```
#### _Headers_ getHeaders( [**Headers** _userHeaders_] )
This method adds the correct `content-type` header to the provided array of `userHeaders`.
#### _String_ getBoundary()
Return the boundary of the formData. By default, the boundary consists of 26 `-` followed by 24 numbers
for example:
```javascript
--------------------------515890814546601021194782
```
#### _Void_ setBoundary(String _boundary_)
Set the boundary string, overriding the default behavior described above.
_Note: The boundary must be unique and may not appear in the data._
#### _Buffer_ getBuffer()
Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data.
```javascript
var form = new FormData();
form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) );
form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') );
axios.post( 'https://example.com/path/to/api',
form.getBuffer(),
form.getHeaders()
)
```
**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error.
#### _Integer_ getLengthSync()
Same as `getLength` but synchronous.
_Note: getLengthSync __doesn't__ calculate streams length._
#### _Integer_ getLength( **function** _callback_ )
Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated
```javascript
this.getLength(function(err, length) {
if (err) {
this._error(err);
return;
}
// add content length
request.setHeader('Content-Length', length);
...
}.bind(this));
```
#### _Boolean_ hasKnownLength()
Checks if the length of added values is known.
#### _Request_ submit( _params_, **function** _callback_ )
Submit the form to a web application.
```javascript
var form = new FormData();
form.append( 'my_string', 'Hello World' );
form.submit( 'http://example.com/', function(err, res) {
// res response object (http.IncomingMessage) //
res.resume();
} );
```
#### _String_ toString()
Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead.
### Integration with other libraries
#### Request
Form submission using [request](https://github.com/request/request):
```javascript
var formData = {
my_field: 'my_value',
my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),
};
request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log('Upload successful! Server responded with:', body);
});
```
For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads).
#### node-fetch
You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch):
```javascript
var form = new FormData();
form.append('a', 1);
fetch('http://example.com', { method: 'POST', body: form })
.then(function(res) {
return res.json();
}).then(function(json) {
console.log(json);
});
```
#### axios
In Node.js you can post a file using [axios](https://github.com/axios/axios):
```javascript
const form = new FormData();
const stream = fs.createReadStream(PATH_TO_FILE);
form.append('image', stream);
// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders`
const formHeaders = form.getHeaders();
axios.post('http://example.com', form, {
headers: {
...formHeaders,
},
})
.then(response => response)
.catch(error => error)
```
## Notes
- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
- Starting version `2.x` FormData has dropped support for `node@0.10.x`.
- Starting version `3.x` FormData has dropped support for `node@4.x`.
## License
Form-Data is released under the [MIT](License) license.

View File

@@ -0,0 +1,356 @@
# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data)
A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
[![Linux Build](https://img.shields.io/travis/form-data/form-data/v3.0.1.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data)
[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v3.0.1.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data)
[![Windows Build](https://img.shields.io/travis/form-data/form-data/v3.0.1.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data)
[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v3.0.1.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master)
[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)
## Install
```
npm install --save form-data
```
## Usage
In this example we are constructing a form with 3 fields that contain a string,
a buffer and a file stream.
``` javascript
var FormData = require('form-data');
var fs = require('fs');
var form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
```
Also you can use http-response stream:
``` javascript
var FormData = require('form-data');
var http = require('http');
var form = new FormData();
http.request('http://nodejs.org/images/logo.png', function(response) {
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_logo', response);
});
```
Or @mikeal's [request](https://github.com/request/request) stream:
``` javascript
var FormData = require('form-data');
var request = require('request');
var form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_logo', request('http://nodejs.org/images/logo.png'));
```
In order to submit this form to a web application, call ```submit(url, [callback])``` method:
``` javascript
form.submit('http://example.org/', function(err, res) {
// res response object (http.IncomingMessage) //
res.resume();
});
```
For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
### Custom options
You can provide custom options, such as `maxDataSize`:
``` javascript
var FormData = require('form-data');
var form = new FormData({ maxDataSize: 20971520 });
form.append('my_field', 'my value');
form.append('my_buffer', /* something big */);
```
List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15)
### Alternative submission methods
You can use node's http client interface:
``` javascript
var http = require('http');
var request = http.request({
method: 'post',
host: 'example.org',
path: '/upload',
headers: form.getHeaders()
});
form.pipe(request);
request.on('response', function(res) {
console.log(res.statusCode);
});
```
Or if you would prefer the `'Content-Length'` header to be set for you:
``` javascript
form.submit('example.org/upload', function(err, res) {
console.log(res.statusCode);
});
```
To use custom headers and pre-known length in parts:
``` javascript
var CRLF = '\r\n';
var form = new FormData();
var options = {
header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
knownLength: 1
};
form.append('my_buffer', buffer, options);
form.submit('http://example.com/', function(err, res) {
if (err) throw err;
console.log('Done');
});
```
Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
``` javascript
someModule.stream(function(err, stdout, stderr) {
if (err) throw err;
var form = new FormData();
form.append('file', stdout, {
filename: 'unicycle.jpg', // ... or:
filepath: 'photos/toys/unicycle.jpg',
contentType: 'image/jpeg',
knownLength: 19806
});
form.submit('http://example.com/', function(err, res) {
if (err) throw err;
console.log('Done');
});
});
```
The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory).
For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
``` javascript
form.submit({
host: 'example.com',
path: '/probably.php?extra=params',
auth: 'username:password'
}, function(err, res) {
console.log(res.statusCode);
});
```
In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
``` javascript
form.submit({
host: 'example.com',
path: '/surelynot.php',
headers: {'x-test-header': 'test-header-value'}
}, function(err, res) {
console.log(res.statusCode);
});
```
### Methods
- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-).
- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-)
- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary)
- [_Void_ setBoundary()](https://github.com/form-data/form-data#void-setboundary)
- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer)
- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync)
- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-)
- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength)
- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-)
- [_String_ toString()](https://github.com/form-data/form-data#string-tostring)
#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )
Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user.
```javascript
var form = new FormData();
form.append( 'my_string', 'my value' );
form.append( 'my_integer', 1 );
form.append( 'my_boolean', true );
form.append( 'my_buffer', new Buffer(10) );
form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) )
```
You may provide a string for options, or an object.
```javascript
// Set filename by providing a string for options
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' );
// provide an object.
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} );
```
#### _Headers_ getHeaders( [**Headers** _userHeaders_] )
This method adds the correct `content-type` header to the provided array of `userHeaders`.
#### _String_ getBoundary()
Return the boundary of the formData. By default, the boundary consists of 26 `-` followed by 24 numbers
for example:
```javascript
--------------------------515890814546601021194782
```
#### _Void_ setBoundary(String _boundary_)
Set the boundary string, overriding the default behavior described above.
_Note: The boundary must be unique and may not appear in the data._
#### _Buffer_ getBuffer()
Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data.
```javascript
var form = new FormData();
form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) );
form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') );
axios.post( 'https://example.com/path/to/api',
form.getBuffer(),
form.getHeaders()
)
```
**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error.
#### _Integer_ getLengthSync()
Same as `getLength` but synchronous.
_Note: getLengthSync __doesn't__ calculate streams length._
#### _Integer_ getLength( **function** _callback_ )
Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated
```javascript
this.getLength(function(err, length) {
if (err) {
this._error(err);
return;
}
// add content length
request.setHeader('Content-Length', length);
...
}.bind(this));
```
#### _Boolean_ hasKnownLength()
Checks if the length of added values is known.
#### _Request_ submit( _params_, **function** _callback_ )
Submit the form to a web application.
```javascript
var form = new FormData();
form.append( 'my_string', 'Hello World' );
form.submit( 'http://example.com/', function(err, res) {
// res response object (http.IncomingMessage) //
res.resume();
} );
```
#### _String_ toString()
Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead.
### Integration with other libraries
#### Request
Form submission using [request](https://github.com/request/request):
```javascript
var formData = {
my_field: 'my_value',
my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),
};
request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log('Upload successful! Server responded with:', body);
});
```
For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads).
#### node-fetch
You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch):
```javascript
var form = new FormData();
form.append('a', 1);
fetch('http://example.com', { method: 'POST', body: form })
.then(function(res) {
return res.json();
}).then(function(json) {
console.log(json);
});
```
#### axios
In Node.js you can post a file using [axios](https://github.com/axios/axios):
```javascript
const form = new FormData();
const stream = fs.createReadStream(PATH_TO_FILE);
form.append('image', stream);
// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders`
const formHeaders = form.getHeaders();
axios.post('http://example.com', form, {
headers: {
...formHeaders,
},
})
.then(response => response)
.catch(error => error)
```
## Notes
- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
- Starting version `2.x` FormData has dropped support for `node@0.10.x`.
- Starting version `3.x` FormData has dropped support for `node@4.x`.
## License
Form-Data is released under the [MIT](License) license.

View File

@@ -0,0 +1,62 @@
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
// Leon Yu <https://github.com/leonyu>
// BendingBender <https://github.com/BendingBender>
// Maple Miao <https://github.com/mapleeit>
/// <reference types="node" />
import * as stream from 'stream';
import * as http from 'http';
export = FormData;
// Extracted because @types/node doesn't export interfaces.
interface ReadableOptions {
highWaterMark?: number;
encoding?: string;
objectMode?: boolean;
read?(this: stream.Readable, size: number): void;
destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void;
autoDestroy?: boolean;
}
interface Options extends ReadableOptions {
writable?: boolean;
readable?: boolean;
dataSize?: number;
maxDataSize?: number;
pauseStreams?: boolean;
}
declare class FormData extends stream.Readable {
constructor(options?: Options);
append(key: string, value: any, options?: FormData.AppendOptions | string): void;
getHeaders(userHeaders?: FormData.Headers): FormData.Headers;
submit(
params: string | FormData.SubmitOptions,
callback?: (error: Error | null, response: http.IncomingMessage) => void
): http.ClientRequest;
getBuffer(): Buffer;
setBoundary(boundary: string): void;
getBoundary(): string;
getLength(callback: (err: Error | null, length: number) => void): void;
getLengthSync(): number;
hasKnownLength(): boolean;
}
declare namespace FormData {
interface Headers {
[key: string]: any;
}
interface AppendOptions {
header?: string | Headers;
knownLength?: number;
filename?: string;
filepath?: string;
contentType?: string;
}
interface SubmitOptions extends http.RequestOptions {
protocol?: 'https:' | 'http:';
}
}

View File

@@ -0,0 +1,2 @@
/* eslint-env browser */
module.exports = typeof self == 'object' ? self.FormData : window.FormData;

View File

@@ -0,0 +1,498 @@
var CombinedStream = require('combined-stream');
var util = require('util');
var path = require('path');
var http = require('http');
var https = require('https');
var parseUrl = require('url').parse;
var fs = require('fs');
var mime = require('mime-types');
var asynckit = require('asynckit');
var populate = require('./populate.js');
// Public API
module.exports = FormData;
// make it a Stream
util.inherits(FormData, CombinedStream);
/**
* Create readable "multipart/form-data" streams.
* Can be used to submit forms
* and file uploads to other web applications.
*
* @constructor
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
*/
function FormData(options) {
if (!(this instanceof FormData)) {
return new FormData(options);
}
this._overheadLength = 0;
this._valueLength = 0;
this._valuesToMeasure = [];
CombinedStream.call(this);
options = options || {};
for (var option in options) {
this[option] = options[option];
}
}
FormData.LINE_BREAK = '\r\n';
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
FormData.prototype.append = function(field, value, options) {
options = options || {};
// allow filename as single option
if (typeof options == 'string') {
options = {filename: options};
}
var append = CombinedStream.prototype.append.bind(this);
// all that streamy business can't handle numbers
if (typeof value == 'number') {
value = '' + value;
}
// https://github.com/felixge/node-form-data/issues/38
if (util.isArray(value)) {
// Please convert your array into string
// the way web server expects it
this._error(new Error('Arrays are not supported.'));
return;
}
var header = this._multiPartHeader(field, value, options);
var footer = this._multiPartFooter();
append(header);
append(value);
append(footer);
// pass along options.knownLength
this._trackLength(header, value, options);
};
FormData.prototype._trackLength = function(header, value, options) {
var valueLength = 0;
// used w/ getLengthSync(), when length is known.
// e.g. for streaming directly from a remote server,
// w/ a known file a size, and not wanting to wait for
// incoming file to finish to get its size.
if (options.knownLength != null) {
valueLength += +options.knownLength;
} else if (Buffer.isBuffer(value)) {
valueLength = value.length;
} else if (typeof value === 'string') {
valueLength = Buffer.byteLength(value);
}
this._valueLength += valueLength;
// @check why add CRLF? does this account for custom/multiple CRLFs?
this._overheadLength +=
Buffer.byteLength(header) +
FormData.LINE_BREAK.length;
// empty or either doesn't have path or not an http response
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
return;
}
// no need to bother with the length
if (!options.knownLength) {
this._valuesToMeasure.push(value);
}
};
FormData.prototype._lengthRetriever = function(value, callback) {
if (value.hasOwnProperty('fd')) {
// take read range into a account
// `end` = Infinity > read file till the end
//
// TODO: Looks like there is bug in Node fs.createReadStream
// it doesn't respect `end` options without `start` options
// Fix it when node fixes it.
// https://github.com/joyent/node/issues/7819
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
// when end specified
// no need to calculate range
// inclusive, starts with 0
callback(null, value.end + 1 - (value.start ? value.start : 0));
// not that fast snoopy
} else {
// still need to fetch file size from fs
fs.stat(value.path, function(err, stat) {
var fileSize;
if (err) {
callback(err);
return;
}
// update final size based on the range options
fileSize = stat.size - (value.start ? value.start : 0);
callback(null, fileSize);
});
}
// or http response
} else if (value.hasOwnProperty('httpVersion')) {
callback(null, +value.headers['content-length']);
// or request stream http://github.com/mikeal/request
} else if (value.hasOwnProperty('httpModule')) {
// wait till response come back
value.on('response', function(response) {
value.pause();
callback(null, +response.headers['content-length']);
});
value.resume();
// something else
} else {
callback('Unknown stream');
}
};
FormData.prototype._multiPartHeader = function(field, value, options) {
// custom header specified (as string)?
// it becomes responsible for boundary
// (e.g. to handle extra CRLFs on .NET servers)
if (typeof options.header == 'string') {
return options.header;
}
var contentDisposition = this._getContentDisposition(value, options);
var contentType = this._getContentType(value, options);
var contents = '';
var headers = {
// add custom disposition as third element or keep it two elements if not
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
// if no content type. allow it to be empty array
'Content-Type': [].concat(contentType || [])
};
// allow custom headers.
if (typeof options.header == 'object') {
populate(headers, options.header);
}
var header;
for (var prop in headers) {
if (!headers.hasOwnProperty(prop)) continue;
header = headers[prop];
// skip nullish headers.
if (header == null) {
continue;
}
// convert all headers to arrays.
if (!Array.isArray(header)) {
header = [header];
}
// add non-empty headers.
if (header.length) {
contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
}
}
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
};
FormData.prototype._getContentDisposition = function(value, options) {
var filename
, contentDisposition
;
if (typeof options.filepath === 'string') {
// custom filepath for relative paths
filename = path.normalize(options.filepath).replace(/\\/g, '/');
} else if (options.filename || value.name || value.path) {
// custom filename take precedence
// formidable and the browser add a name property
// fs- and request- streams have path property
filename = path.basename(options.filename || value.name || value.path);
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
// or try http response
filename = path.basename(value.client._httpMessage.path || '');
}
if (filename) {
contentDisposition = 'filename="' + filename + '"';
}
return contentDisposition;
};
FormData.prototype._getContentType = function(value, options) {
// use custom content-type above all
var contentType = options.contentType;
// or try `name` from formidable, browser
if (!contentType && value.name) {
contentType = mime.lookup(value.name);
}
// or try `path` from fs-, request- streams
if (!contentType && value.path) {
contentType = mime.lookup(value.path);
}
// or if it's http-reponse
if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
contentType = value.headers['content-type'];
}
// or guess it from the filepath or filename
if (!contentType && (options.filepath || options.filename)) {
contentType = mime.lookup(options.filepath || options.filename);
}
// fallback to the default content type if `value` is not simple value
if (!contentType && typeof value == 'object') {
contentType = FormData.DEFAULT_CONTENT_TYPE;
}
return contentType;
};
FormData.prototype._multiPartFooter = function() {
return function(next) {
var footer = FormData.LINE_BREAK;
var lastPart = (this._streams.length === 0);
if (lastPart) {
footer += this._lastBoundary();
}
next(footer);
}.bind(this);
};
FormData.prototype._lastBoundary = function() {
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
};
FormData.prototype.getHeaders = function(userHeaders) {
var header;
var formHeaders = {
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
};
for (header in userHeaders) {
if (userHeaders.hasOwnProperty(header)) {
formHeaders[header.toLowerCase()] = userHeaders[header];
}
}
return formHeaders;
};
FormData.prototype.setBoundary = function(boundary) {
this._boundary = boundary;
};
FormData.prototype.getBoundary = function() {
if (!this._boundary) {
this._generateBoundary();
}
return this._boundary;
};
FormData.prototype.getBuffer = function() {
var dataBuffer = new Buffer.alloc( 0 );
var boundary = this.getBoundary();
// Create the form content. Add Line breaks to the end of data.
for (var i = 0, len = this._streams.length; i < len; i++) {
if (typeof this._streams[i] !== 'function') {
// Add content to the buffer.
if(Buffer.isBuffer(this._streams[i])) {
dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
}else {
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
}
// Add break after content.
if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
}
}
}
// Add the footer and return the Buffer object.
return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
};
FormData.prototype._generateBoundary = function() {
// This generates a 50 character boundary similar to those used by Firefox.
// They are optimized for boyer-moore parsing.
var boundary = '--------------------------';
for (var i = 0; i < 24; i++) {
boundary += Math.floor(Math.random() * 10).toString(16);
}
this._boundary = boundary;
};
// Note: getLengthSync DOESN'T calculate streams length
// As workaround one can calculate file size manually
// and add it as knownLength option
FormData.prototype.getLengthSync = function() {
var knownLength = this._overheadLength + this._valueLength;
// Don't get confused, there are 3 "internal" streams for each keyval pair
// so it basically checks if there is any value added to the form
if (this._streams.length) {
knownLength += this._lastBoundary().length;
}
// https://github.com/form-data/form-data/issues/40
if (!this.hasKnownLength()) {
// Some async length retrievers are present
// therefore synchronous length calculation is false.
// Please use getLength(callback) to get proper length
this._error(new Error('Cannot calculate proper length in synchronous way.'));
}
return knownLength;
};
// Public API to check if length of added values is known
// https://github.com/form-data/form-data/issues/196
// https://github.com/form-data/form-data/issues/262
FormData.prototype.hasKnownLength = function() {
var hasKnownLength = true;
if (this._valuesToMeasure.length) {
hasKnownLength = false;
}
return hasKnownLength;
};
FormData.prototype.getLength = function(cb) {
var knownLength = this._overheadLength + this._valueLength;
if (this._streams.length) {
knownLength += this._lastBoundary().length;
}
if (!this._valuesToMeasure.length) {
process.nextTick(cb.bind(this, null, knownLength));
return;
}
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
if (err) {
cb(err);
return;
}
values.forEach(function(length) {
knownLength += length;
});
cb(null, knownLength);
});
};
FormData.prototype.submit = function(params, cb) {
var request
, options
, defaults = {method: 'post'}
;
// parse provided url if it's string
// or treat it as options object
if (typeof params == 'string') {
params = parseUrl(params);
options = populate({
port: params.port,
path: params.pathname,
host: params.hostname,
protocol: params.protocol
}, defaults);
// use custom params
} else {
options = populate(params, defaults);
// if no port provided use default one
if (!options.port) {
options.port = options.protocol == 'https:' ? 443 : 80;
}
}
// put that good code in getHeaders to some use
options.headers = this.getHeaders(params.headers);
// https if specified, fallback to http in any other case
if (options.protocol == 'https:') {
request = https.request(options);
} else {
request = http.request(options);
}
// get content length and fire away
this.getLength(function(err, length) {
if (err) {
this._error(err);
return;
}
// add content length
request.setHeader('Content-Length', length);
this.pipe(request);
if (cb) {
var onResponse;
var callback = function (error, responce) {
request.removeListener('error', callback);
request.removeListener('response', onResponse);
return cb.call(this, error, responce);
};
onResponse = callback.bind(this, null);
request.on('error', callback);
request.on('response', onResponse);
}
}.bind(this));
return request;
};
FormData.prototype._error = function(err) {
if (!this.error) {
this.error = err;
this.pause();
this.emit('error', err);
}
};
FormData.prototype.toString = function () {
return '[object FormData]';
};

View File

@@ -0,0 +1,10 @@
// populates missing values
module.exports = function(dst, src) {
Object.keys(src).forEach(function(prop)
{
dst[prop] = dst[prop] || src[prop];
});
return dst;
};

View File

@@ -0,0 +1,68 @@
{
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
"name": "form-data",
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
"version": "3.0.1",
"repository": {
"type": "git",
"url": "git://github.com/form-data/form-data.git"
},
"main": "./lib/form_data",
"browser": "./lib/browser",
"typings": "./index.d.ts",
"scripts": {
"pretest": "rimraf coverage test/tmp",
"test": "istanbul cover test/run.js",
"posttest": "istanbul report lcov text",
"lint": "eslint lib/*.js test/*.js test/integration/*.js",
"report": "istanbul report lcov text",
"ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8",
"ci-test": "npm run test && npm run browser && npm run report",
"predebug": "rimraf coverage test/tmp",
"debug": "verbose=1 ./test/run.js",
"browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage",
"check": "istanbul check-coverage coverage/coverage*.json",
"files": "pkgfiles --sort=name",
"get-version": "node -e \"console.log(require('./package.json').version)\"",
"update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md",
"restore-readme": "mv README.md.bak README.md",
"prepublish": "in-publish && npm run update-readme || not-in-publish",
"postpublish": "npm run restore-readme"
},
"pre-commit": [
"lint",
"ci-test",
"check"
],
"engines": {
"node": ">= 6"
},
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"devDependencies": {
"@types/node": "^12.0.10",
"browserify": "^13.1.1",
"browserify-istanbul": "^2.0.0",
"coveralls": "^3.0.4",
"cross-spawn": "^6.0.5",
"eslint": "^6.0.1",
"fake": "^0.2.2",
"far": "^0.0.7",
"formidable": "^1.0.17",
"in-publish": "^2.0.0",
"is-node-modern": "^1.0.0",
"istanbul": "^0.4.5",
"obake": "^0.1.2",
"puppeteer": "^1.19.0",
"pkgfiles": "^2.3.0",
"pre-commit": "^1.1.3",
"request": "^2.88.0",
"rimraf": "^2.7.1",
"tape": "^4.6.2",
"typescript": "^3.5.2"
},
"license": "MIT"
}

83
node_modules/@types/node-fetch/package.json generated vendored Executable file
View File

@@ -0,0 +1,83 @@
{
"name": "@types/node-fetch",
"version": "2.6.2",
"description": "TypeScript definitions for node-fetch",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch",
"license": "MIT",
"contributors": [
{
"name": "Torsten Werner",
"url": "https://github.com/torstenwerner",
"githubUsername": "torstenwerner"
},
{
"name": "Niklas Lindgren",
"url": "https://github.com/nikcorg",
"githubUsername": "nikcorg"
},
{
"name": "Vinay Bedre",
"url": "https://github.com/vinaybedre",
"githubUsername": "vinaybedre"
},
{
"name": "Antonio Román",
"url": "https://github.com/kyranet",
"githubUsername": "kyranet"
},
{
"name": "Andrew Leedham",
"url": "https://github.com/AndrewLeedham",
"githubUsername": "AndrewLeedham"
},
{
"name": "Jason Li",
"url": "https://github.com/JasonLi914",
"githubUsername": "JasonLi914"
},
{
"name": "Steve Faulkner",
"url": "https://github.com/southpolesteve",
"githubUsername": "southpolesteve"
},
{
"name": "ExE Boss",
"url": "https://github.com/ExE-Boss",
"githubUsername": "ExE-Boss"
},
{
"name": "Alex Savin",
"url": "https://github.com/alexandrusavin",
"githubUsername": "alexandrusavin"
},
{
"name": "Alexis Tyler",
"url": "https://github.com/OmgImAlexis",
"githubUsername": "OmgImAlexis"
},
{
"name": "Jakub Kisielewski",
"url": "https://github.com/kbkk",
"githubUsername": "kbkk"
},
{
"name": "David Glasser",
"url": "https://github.com/glasser",
"githubUsername": "glasser"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/node-fetch"
},
"scripts": {},
"dependencies": {
"@types/node": "*",
"form-data": "^3.0.0"
},
"typesPublisherContentHash": "f539217db3abcaeb4bea994aff274ddc22cfba7cf3758c120545a305f7437942",
"typeScriptVersion": "4.0"
}

21
node_modules/@types/tunnel/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

67
node_modules/@types/tunnel/README.md generated vendored Executable file
View File

@@ -0,0 +1,67 @@
# Installation
> `npm install --save @types/tunnel`
# Summary
This package contains type definitions for tunnel (https://github.com/koichik/node-tunnel/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tunnel.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tunnel/index.d.ts)
````ts
// Type definitions for tunnel 0.0
// Project: https://github.com/koichik/node-tunnel/
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Agent } from 'http';
import { Agent as HttpsAgent } from 'https';
export function httpOverHttp(options?: HttpOptions): Agent;
export function httpsOverHttp(options?: HttpsOverHttpOptions): Agent;
export function httpOverHttps(options?: HttpOverHttpsOptions): HttpsAgent;
export function httpsOverHttps(options?: HttpsOverHttpsOptions): HttpsAgent;
export interface HttpOptions {
maxSockets?: number | undefined;
proxy?: ProxyOptions | undefined;
}
export interface HttpsOverHttpOptions extends HttpOptions {
ca?: Buffer[] | undefined;
key?: Buffer | undefined;
cert?: Buffer | undefined;
}
export interface HttpOverHttpsOptions extends HttpOptions {
proxy?: HttpsProxyOptions | undefined;
}
export interface HttpsOverHttpsOptions extends HttpsOverHttpOptions {
proxy?: HttpsProxyOptions | undefined;
}
export interface ProxyOptions {
host: string;
port: number;
localAddress?: string | undefined;
proxyAuth?: string | undefined;
headers?: { [key: string]: any } | undefined;
}
export interface HttpsProxyOptions extends ProxyOptions {
ca?: Buffer[] | undefined;
servername?: string | undefined;
key?: Buffer | undefined;
cert?: Buffer | undefined;
}
````
### Additional Details
* Last updated: Fri, 02 Jul 2021 19:37:21 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written by [BendingBender](https://github.com/BendingBender).

47
node_modules/@types/tunnel/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,47 @@
// Type definitions for tunnel 0.0
// Project: https://github.com/koichik/node-tunnel/
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Agent } from 'http';
import { Agent as HttpsAgent } from 'https';
export function httpOverHttp(options?: HttpOptions): Agent;
export function httpsOverHttp(options?: HttpsOverHttpOptions): Agent;
export function httpOverHttps(options?: HttpOverHttpsOptions): HttpsAgent;
export function httpsOverHttps(options?: HttpsOverHttpsOptions): HttpsAgent;
export interface HttpOptions {
maxSockets?: number | undefined;
proxy?: ProxyOptions | undefined;
}
export interface HttpsOverHttpOptions extends HttpOptions {
ca?: Buffer[] | undefined;
key?: Buffer | undefined;
cert?: Buffer | undefined;
}
export interface HttpOverHttpsOptions extends HttpOptions {
proxy?: HttpsProxyOptions | undefined;
}
export interface HttpsOverHttpsOptions extends HttpsOverHttpOptions {
proxy?: HttpsProxyOptions | undefined;
}
export interface ProxyOptions {
host: string;
port: number;
localAddress?: string | undefined;
proxyAuth?: string | undefined;
headers?: { [key: string]: any } | undefined;
}
export interface HttpsProxyOptions extends ProxyOptions {
ca?: Buffer[] | undefined;
servername?: string | undefined;
key?: Buffer | undefined;
cert?: Buffer | undefined;
}

27
node_modules/@types/tunnel/package.json generated vendored Executable file
View File

@@ -0,0 +1,27 @@
{
"name": "@types/tunnel",
"version": "0.0.3",
"description": "TypeScript definitions for tunnel",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tunnel",
"license": "MIT",
"contributors": [
{
"name": "BendingBender",
"url": "https://github.com/BendingBender",
"githubUsername": "BendingBender"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/tunnel"
},
"scripts": {},
"dependencies": {
"@types/node": "*"
},
"typesPublisherContentHash": "049a52929c6badcca87fc0ebc590bc49744a75f883bf18df77393ba05ddb4e7b",
"typeScriptVersion": "3.6"
}