From 2d0a9ffbccf9d8a4773eb6efa48ddc6978af6455 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 6 Apr 2023 12:53:53 -0400 Subject: refactor(ext/node): `NodeFs` - add back altered metadata method (#18613) From https://github.com/denoland/deno/pull/18604/files#r1159992299 We should still have a `metadata` method because it's one system call instead of two on most platforms. --- ext/node/ops.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/node/ops.rs') diff --git a/ext/node/ops.rs b/ext/node/ops.rs index 77d148383..3db23b5ea 100644 --- a/ext/node/ops.rs +++ b/ext/node/ops.rs @@ -264,8 +264,8 @@ where { let path = PathBuf::from(path); ensure_read_permission::(state, &path)?; - if Env::Fs::exists(&path) { - if Env::Fs::is_file(&path) { + if let Ok(metadata) = Env::Fs::metadata(&path) { + if metadata.is_file { return Ok(0); } else { return Ok(1); -- cgit v1.2.3