We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util.promisify(fs.exists)
util.promisify works differently in node and deno_std/node when the fs.exists is passed to it.
util.promisify
deno_std/node
The following code prints Error!!!\ntrue (assuming README.md exists in current dir)
Error!!!\ntrue
import { promisify } from "https://deno.land/std@0.146.0/node/util.ts"; import { exists } from "https://deno.land/std@0.146.0/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:
Success\ntrue
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) })
The text was updated successfully, but these errors were encountered:
This was fixed in #2409. Closing.
Sorry, something went wrong.
No branches or pull requests
util.promisify
works differently in node anddeno_std/node
when the fs.exists is passed to it.The following code prints
Error!!!\ntrue
(assuming README.md exists in current dir)On the othe hand, the following prints
Success\ntrue
with node.js:The text was updated successfully, but these errors were encountered: