Skip to content

fs.write() has two signatures, so it's broken with promisify-node #22

@slikts

Description

@slikts

From the docs:

fs.write(fd, buffer, offset, length[, position], callback)
fs.write(fd, data[, position[, encoding]], callback)

By default the method signature is this:

function (fd, buffer, offset, length, position, callback)

The parameters can change depending on the input:

if (buffer instanceof Buffer) {
    // if no position is passed then assume null
    if (typeof position === 'function') {
      callback = position;
      position = null;
    }

The tls.connect() method also has two different signatures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions