Skip to content

Allow hints to disable binary check #81

Closed
@calzoneman

Description

@calzoneman

encode uses has-binary2 to check if the given data is binary or not:

if ((obj.type === exports.EVENT || obj.type === exports.ACK) && hasBin(obj.data)) {

has-binary2 has a bunch of early exits if it does find binary data, but in the case where the input is not binary, it ends up recursively walking the entire object.

It would be nice if I could pass a flag through from socket.io to say "I already know this isn't binary, so don't even bother checking" to avoid this additional expense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions