Skip to content

blobReadingMethods

Prefer direct Blob reading methods over wrapping in Response for simpler code.

✅ This rule is included in the node stylistic preset.

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.

const text = await new Response(blob).text();
const arrayBuffer = await new Response(blob).arrayBuffer();
const bytes = await new Response(blob).bytes();

This rule is not configurable.

If you need to use Response-specific functionality while reading the Blob data, you might choose not to enable this rule.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.