MCPcopy Create free account
hub / github.com/nodejs/node / blob

Function blob

deps/undici/src/lib/web/fetch/body.js:297–316  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

295function bodyMixinMethods (instance, getInternalState) {
296 const methods = {
297 blob () {
298 // The blob() method steps are to return the result of
299 // running consume body with this and the following step
300 // given a byte sequence bytes: return a Blob whose
301 // contents are bytes and whose type attribute is this’s
302 // MIME type.
303 return consumeBody(this, (bytes) => {
304 let mimeType = bodyMimeType(getInternalState(this))
305
306 if (mimeType === null) {
307 mimeType = ''
308 } else if (mimeType) {
309 mimeType = serializeAMimeType(mimeType)
310 }
311
312 // Return a Blob whose contents are bytes and type attribute
313 // is mimeType.
314 return new Blob([bytes], { type: mimeType })
315 }, instance, getInternalState)
316 },
317
318 arrayBuffer () {
319 // The arrayBuffer() method steps are to return the result

Callers

nothing calls this directly

Calls 3

consumeBodyFunction · 0.70
bodyMimeTypeFunction · 0.70
serializeAMimeTypeFunction · 0.70

Tested by

no test coverage detected