Skip to content

the default type argument for blob.slice should be empty string #37352

Closed
@jimmywarting

Description

@jimmywarting

I took a peek at buffer.Blob.toString() and saw that the type argument was defaulted to itself

slice(start = 0, end = (this[kLength]), type = this[kType]) {

that is not the case in the browser (it's not what we are doing in fetch-blob) and the spec says it should default the type to a empty string if it's not provided

If the contentType parameter is not provided, let relativeContentType be set to the empty string.
https://w3c.github.io/FileAPI/#slice-method-algo

What is the expected behavior?

new buffer.Blob([], {type: 'text/html'}).slice().type === ''

What do you see instead?

new buffer.Blob([], {type: 'text/html'}).slice().type === 'text/html'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions