Skip to content

Commit 84119a1

Browse files
committed
Add docs for instance properties
1 parent 1c92037 commit 84119a1

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

lib/Encoder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const CRLF_BYTES_LENGTH = CRLF_BYTES.byteLength
1313

1414
export class Encoder {
1515
/**
16-
* Returns a boundary string
16+
* Returns boundary string
1717
*/
1818
readonly boundary: string
1919

@@ -68,7 +68,7 @@ export class Encoder {
6868
}
6969

7070
/**
71-
* Returns headers for multipart/form-data
71+
* Returns headers object with Content-Type and Content-Length header
7272
*/
7373
get headers() {
7474
return {

readme.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,33 @@ pnpm add form-data-encoder
9191

9292
### `class Encoder`
9393

94-
#### `constructor(form[, boundary]) -> {Encoder}`
94+
##### `constructor(form[, boundary]) -> {Encoder}`
9595

9696
- **{FormDataLike}** form - A FormData object to encode. This object must be a spec-compatible FormData implementation.
9797
- **{string}** 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.
9898

9999
Creates a multipart/form-data encoder.
100100

101-
#### `encode() -> {AsyncGenerator<Uint8Array, void, undefined>}`
101+
#### Instance properties
102+
103+
##### `boundary -> {string}`
104+
105+
Returns boundary string
106+
107+
##### `contentType -> {string}`
108+
109+
Returns Content-Type header for multipart/form-data
110+
111+
##### `headers -> {object}`
112+
113+
Returns headers object with Content-Type and Content-Length header
114+
115+
#### Instance methods
116+
117+
##### `encode() -> {AsyncGenerator<Uint8Array, void, undefined>}`
102118

103119
Creates an async iterator allowing to perform the encoding by portions.
104120

105-
#### `[Symbol.asyncIterator]() -> {AsyncGenerator<Uint8Array, void, undefined>}`
121+
##### `[Symbol.asyncIterator]() -> {AsyncGenerator<Uint8Array, void, undefined>}`
106122

107123
An alias for `Encoder#encode()` method.

0 commit comments

Comments
 (0)