Skip to content

fs.exists("") returns Promise<undefined> #32

@syndicatedshannon

Description

@syndicatedshannon
var promisifyNode = require("promisify-node");
var fs = require("fs");
var util = require("util");

async function testOne(existsFn) {
    var prom = existsFn("test").catch(e => console.log("error " + e));
    console.log("result " + await prom);
}

async function testBoth() {
    console.log("---builtin");
    var builtin = util.promisify(fs.exists);
    await testOne(builtin);

    console.log("---library");
    var library = promisifyNode(fs).exists;
    await testOne(library);
}

testBoth();

result:

---builtin
result false

---library
result undefined

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