blobReadingMethods
Prefer direct Blob reading methods over wrapping in Response for simpler code.
✅ This rule is included in the nodestylisticandstylisticStrictpresets.
Direct Blob methods are simpler and more direct than wrapping the Blob in a Response object. The Response wrapper adds unnecessary complexity when the Blob already provides the needed methods.
Examples
Section titled “Examples”const text = await new Response(blob).text();
const arrayBuffer = await new Response(blob).arrayBuffer();
const bytes = await new Response(blob).bytes();const text = await blob.text();
const arrayBuffer = await blob.arrayBuffer();
const bytes = await blob.bytes();Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you need to use Response-specific functionality while reading the Blob data, you might choose not to enable this rule.