formdata-node
Advanced tools
Comparing version 4.2.2 to 4.2.3
@@ -44,3 +44,3 @@ import { Blob, BlobPropertyBag } from "./Blob"; | ||
*/ | ||
constructor(fileBits: unknown[], name: string, options?: FileOptions); | ||
constructor(fileBits: unknown[], name: string, options?: FilePropertyBag); | ||
get name(): string; | ||
@@ -47,0 +47,0 @@ get lastModified(): number; |
@@ -101,5 +101,5 @@ /// <reference types="node" /> | ||
*/ | ||
forEach(fn: (value: FormDataEntryValue, key: string, fd: FormData) => void, ctx?: unknown): void; | ||
forEach(callback: (value: FormDataEntryValue, key: string, form: FormData) => void, thisArg?: unknown): void; | ||
get [Symbol.toStringTag](): string; | ||
[inspect.custom](): string; | ||
} |
@@ -101,5 +101,8 @@ "use strict"; | ||
if (done) { | ||
return controller.close(); | ||
return queueMicrotask(() => controller.close()); | ||
} | ||
controller.enqueue(value); | ||
}, | ||
async cancel() { | ||
await iterator.return(); | ||
} | ||
@@ -106,0 +109,0 @@ }); |
@@ -114,5 +114,5 @@ "use strict"; | ||
} | ||
forEach(fn, ctx) { | ||
forEach(callback, thisArg) { | ||
for (const [name, value] of this) { | ||
fn.call(ctx, value, name, this); | ||
callback.call(thisArg, value, name, this); | ||
} | ||
@@ -119,0 +119,0 @@ } |
@@ -98,5 +98,8 @@ /*! Based on fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> & David Frank */ | ||
if (done) { | ||
return controller.close(); | ||
return queueMicrotask(() => controller.close()); | ||
} | ||
controller.enqueue(value); | ||
}, | ||
async cancel() { | ||
await iterator.return(); | ||
} | ||
@@ -103,0 +106,0 @@ }); |
@@ -108,5 +108,5 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
} | ||
forEach(fn, ctx) { | ||
forEach(callback, thisArg) { | ||
for (const [name, value] of this) { | ||
fn.call(ctx, value, name, this); | ||
callback.call(thisArg, value, name, this); | ||
} | ||
@@ -113,0 +113,0 @@ } |
{ | ||
"name": "formdata-node", | ||
"version": "4.2.2", | ||
"version": "4.2.3", | ||
"description": "Spec-compliant FormData implementation for Node.js", | ||
"repository": "octet-stream/form-data", | ||
"sideEffects": false, | ||
"keywords": [ | ||
@@ -7,0 +8,0 @@ "form-data", |
@@ -9,2 +9,11 @@ # FormData | ||
## Highlights | ||
1. Spec-compliant: implements every method of the [`FormData interface`](https://developer.mozilla.org/en-US/docs/Web/API/FormData). | ||
2. Supports Blobs and Files sourced from anywhere: you can use builtin [`fileFromPath`](#filefrompathpath-filename-options---promisefile) and [`fileFromPathSync`](#filefrompathsyncpath-filename-options---file) helpers to create a File from FS, or you can implement your `BlobDataItem` object to use a different source of data. | ||
3. Supports both ESM and CJS targets. See [`ESM/CJS support`](#esmcjs-support) section for details. | ||
4. Written on TypeScript and ships with TS typings. | ||
5. Isomorphic, but only re-exports native FormData object for browsers. If you need a polyfill for browsers, use [`formdata-polyfill`](https://github.com/jimmywarting/FormData) | ||
6. It's a [`ponyfill`](https://ponyfill.com/)! Which means, no effect has been caused on `globalThis` or native `FormData` implementation. | ||
## Installation | ||
@@ -53,3 +62,3 @@ | ||
2. If your HTTP client does not support spec-compliant FomrData, you can use [`form-data-encoder`](https://github.com/octet-stream/form-data-encoder) to encode entries: | ||
2. If your HTTP client does not support spec-compliant FormData, you can use [`form-data-encoder`](https://github.com/octet-stream/form-data-encoder) to encode entries: | ||
@@ -269,3 +278,3 @@ ```js | ||
##### `forEach(callback[, ctx]) -> {void}` | ||
##### `forEach(callback[, thisArg]) -> {void}` | ||
@@ -277,4 +286,4 @@ Executes a given **callback** for each field of the FormData instance | ||
+ **{string}** name – Name of the current field. | ||
+ **{FormData}** fd – The FormData instance that **forEach** is being applied to | ||
- **{unknown}** [ctx = null] – Value to use as **this** context when executing the given **callback** | ||
+ **{FormData}** form – The FormData instance that **forEach** is being applied to | ||
- **{unknown}** [thisArg = null] – Value to use as **this** context when executing the given **callback** | ||
@@ -281,0 +290,0 @@ ##### `keys() -> {Generator<string>}` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80378
1280
409