Skip to content

isDirectory() and related functions don't work in node >= 6.3.0 #48

@brokenbot

Description

@brokenbot

Calling isDirectory(), or any related function always returns false.

The issue is due to a change in a node 3.6.0 of reordering the constants when called with process.binding.

Pre node 3.6.0:

constants { .... S_IFMT: 61440, S_IFREG: 32768, S_IFDIR: 16384, S_IFCHR: 8192, S_IFBLK: 24576, S_IFIFO: 4096, S_IFLNK: 40960, ... }
in node >= 6.3.0
constants { ... fs: { O_RDONLY: 0, O_WRONLY: 1, O_RDWR: 2, S_IFMT: 61440, S_IFREG: 32768, S_IFDIR: 16384, S_IFCHR: 8192, S_IFBLK: 24576, S_IFIFO: 4096, S_IFLNK: 40960, S_IFSOCK: 49152, ... } ... }

Here is the offending code ssh2-streams/lib/sftp.js
var constants = process.binding('constants');

verified changing to a required as below resolve the issue.

var constants =require('constants');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions