-
Notifications
You must be signed in to change notification settings - Fork 653
Closed
Description
util.promisify
works differently in node and deno_std/node
when the fs.exists is passed to it.
The following code prints Error!!!\ntrue
(assuming README.md exists in current dir)
import { promisify } from "https://deno.land/[email protected]/node/util.ts";
import { exists } from "https://deno.land/[email protected]/node/fs.ts";
const pExists = promisify(exists);
try {
const result = await pExists("README.md")
console.log("exists", result);
} catch(e) {
console.log("Error!!!");
console.log(e)
}
On the othe hand, the following prints Success\ntrue
with node.js:
const util = require("util");
const fs = require("fs");
const pExists = util.promisify(fs.exists);
pExists("README.md").then(x => {
console.log("Success");
console.log(x)
}).catch((e) => {
console.log("Error!!!");
console.log(e)
})
Metadata
Metadata
Assignees
Labels
No labels