You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A nice helper to prepare a Stream-backed or Buffer-backed file upload for use with our GraphQL API.
122
-
*`pathOrStream` (String | Stream | Buffer) - An existing `Stream` OR an existing `Buffer` OR a string representing a fully resolved path to a file to be read into a new `Stream`.
123
-
*`options` (Object) - [UploadOptions](#uploadoptions) for the resulting object.
122
+
*`pathOrStreamLikeThing` (String | Stream | Buffer) - An existing `Stream`, `Buffer` or other Stream-like thing supported by [FormData.append](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-) OR a string representing a fully resolved path to a file to be read into a new `Stream`.
123
+
*`options` (Object) - Anything supported by [FormData.append](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-). Likely required when providing a non-standard stream. From the `form-data` docs:
124
+
> Form-Data can recognize and fetch all the required information from common types of streams (fs.readStream, http.response and mikeal's request), for some other types of streams you'd need to provide "file"-related information manually
124
125
* Returns an `Object` that is properly formatted to be coerced by the client for use against our GraphQL API wherever an `Upload` type is required.
125
126
126
127
### Types
@@ -135,16 +136,6 @@ Options for the Anvil Client. Defaults are shown after each option key.
135
136
}
136
137
```
137
138
138
-
##### UploadOptions
139
-
140
-
Options for the upload preparation class methods.
141
-
```js
142
-
{
143
-
filename:<filename>, // String
144
-
mimetype:<mimetype>// String
145
-
}
146
-
```
147
-
148
139
### Rate Limits
149
140
150
141
Our API has request rate limits in place. This API client handles `429 Too Many Requests` errors by waiting until it can retry again, then retrying the request. The client attempts to avoid `429` errors by throttling requests after the number of requests within the specified time period has been reached.
0 commit comments