Skip to content

Commit 6460c0a

Browse files
committed
Add docs for Encoder#encode() method.
1 parent d49d588 commit 6460c0a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Encoder.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import isFile from "./util/isFile"
66
import {FormDataLike} from "./FormDataLike"
77

88
const DASHES = "-".repeat(2)
9+
910
const CRLF = "\r\n"
1011
const CRLF_BYTES = new TextEncoder().encode(CRLF)
1112
const CRLF_BYTES_LENGTH = CRLF_BYTES.byteLength
@@ -91,6 +92,9 @@ export class Encoder {
9192
return length + this.#footer.byteLength
9293
}
9394

95+
/**
96+
* Creates an async iterator allowing to perform the encoding by portions.
97+
*/
9498
async* encode(): AsyncGenerator<Uint8Array, void, undefined> {
9599
for (const [name, value] of this.#form) {
96100
yield this._getFieldHeader(name, value)

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Creates a multipart/form-data encoder.
100100

101101
#### `encode() -> {AsyncGenerator<Buffer, void, undefined>}`
102102

103-
Creates an async iterator allowing to perform encoding process by portions.
103+
Creates an async iterator allowing to perform the encoding by portions.
104104

105105
#### `[Symbol.asyncIterator]() -> {AsyncGenerator<Buffer, void, undefined>}`
106106

0 commit comments

Comments
 (0)