Skip to content

Commit 5695bca

Browse files
committed
-Fixed: Eerror in the documentations as indicated in #439
1 parent a70ef2a commit 5695bca

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,17 @@ _Note: The boundary must be unique and may not appear in the data._
229229

230230
#### _Buffer_ getBuffer()
231231
Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data.
232-
233232
```javascript
234233
var form = new FormData();
235234
form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) );
236-
form.append( 'my_file', fs.createReadStream('/foo/bar.jpg') );
235+
form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') );
237236

238237
axios.post( 'https://example.com/path/to/api',
239238
form.getBuffer(),
240239
form.getHeaders()
241240
)
242241
```
242+
**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.
243243

244244
#### _Integer_ getLengthSync()
245245
Same as `getLength` but synchronous.

0 commit comments

Comments
 (0)