Skip to content

Commit 44159ed

Browse files
committed
Improve documentation for FormDataEncoder constructor.
1 parent 89171fe commit 44159ed

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/FormDataEncoder.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export class FormDataEncoder {
9191
*
9292
* @example
9393
*
94+
* ```js
9495
* import {Readable} from "stream"
9596
*
9697
* import {FormData, File, fileFromPath} from "formdata-node"
@@ -115,9 +116,24 @@ export class FormDataEncoder {
115116
* const response = await fetch("https://httpbin.org/post", options)
116117
*
117118
* console.log(await response.json())
119+
* ```
118120
*/
119121
constructor(form: FormDataLike)
122+
123+
/**
124+
* Creates multipart/form-data encoder with custom boundary string.
125+
*
126+
* @param form FormData object to encode. This object must be a spec-compatible FormData implementation.
127+
* @param boundary An optional boundary string that will be used by the encoder. If there's no boundary string is present, Encoder will generate it automatically.
128+
*/
120129
constructor(form: FormDataLike, boundary: string)
130+
131+
/**
132+
* Creates multipart/form-data encoder with additional options.
133+
*
134+
* @param form FormData object to encode. This object must be a spec-compatible FormData implementation.
135+
* @param options Additional options
136+
*/
121137
constructor(form: FormDataLike, options: FormDataEncoderOptions)
122138
constructor(
123139
form: FormDataLike,

0 commit comments

Comments
 (0)