Skip to content

algorithm function now takes options param which is always an empty object #25

@h4l

Description

@h4l

0.3.1 (specifically #18) changed the algorithm option's signature from function(buf, callback) to function(buf, options, callback), but options is pointless as it's always an empty object.

this.compressionOptions is only populated if this.algorithm is a string

It seems to me that there are two options:

1. Remove the option arg added in 0.3.1

Pros:

  • Simpler code
  • Options is not really needed as the algorithm function can obtain options from its closure

Cons:

  • Would re-break configs for people who've now adapted to the the API change introduced in 0.3.1

2. Populate the option object with values so that it's not always empty

Pros:

  • Option arg would serve a purpose
  • Can configure custom algorithm functions without using an anon func & closure each time

Cons:

  • Not really sure that it's helpful/required

My inclination is to go with option 1 to keep things simple, but perhaps it's best to go with 2 to avoid changing the algorithm func signature a second time. I'll create a PR for each option in a sec.

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