Enumeration: FetchResultTypes
@sapphire/fetch.FetchResultTypes
The supported return types for the fetch
method
Enumeration Members
Blob
• Blob = "blob"
Returns only the body, as a Blob
.
Remark
For NodeJS environment other FetchResultTypes
are recommended, but you can use a Blob if you want to.
Defined in
projects/utilities/packages/fetch/src/lib/types.ts:22
Buffer
• Buffer = "buffer"
Returns only the body, as a Buffer.
Remark
Does not work in a Browser environment. For browsers use Blob instead.
If you use this type in a Browsers environment a ReferenceError ReferenceError: Buffer is not defined
will be thrown!
Defined in
projects/utilities/packages/fetch/src/lib/types.ts:17
JSON
• JSON = "json"
Returns only the body, as JSON. Similar to Body.json()
.
You should provide your own type cast (either through the generic return type, or with as <type>
) to the response to define
the JSON structure, otherwise the result will be unknown
.
Defined in
projects/utilities/packages/fetch/src/lib/types.ts:11
Result
• Result = "result"
Returns the entire response and doesn't parse the body
in any way.
Defined in
projects/utilities/packages/fetch/src/lib/types.ts:30
Text
• Text = "text"
Returns only the body, as plain text. Similar to Body.text()
.