question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add exists() function to FileSystemProvider

See original GitHub issue

When trying to write a file to a file system, it’s often helpful to warn the user when that file already exists (and then prompt to overwrite, skip, or cancel the operation). The FileSystemProvider interface has a stat() method that can be used for that purpose, but it throws when the file does not exist. However, asking for information about a file that doesn’t exist is not really an exceptional case, and trapping an exception trying to determine what it represents–that is, the lack of the file or some other error–is less than ideal. The stat() method could just return undefined when the file does not exist but, that would be a breaking change.

Instead, I propose adding a exists(): Thenable<boolean> function to FileSystemProvider that returns a simple yes/no. (If yes, and more details were required, the extension could then call stat().)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
DavidAnsoncommented, Aug 17, 2021
2reactions
jriekencommented, Jan 29, 2021

Let’s make sure this doesn’t disappear

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileSystemProvider (Java Platform SE 7 )
Returns an existing FileSystem created by this provider. This method returns a reference to a FileSystem that was created by invoking the newFileSystem(URI,Map) ......
Read more >
How to use file system function 'exists' in symfony2?
In Symfony 5, it does work. It looks like it requires an array for files. use Symfony\Component\Filesystem\Filesystem ...
Read more >
Filesystem — ESP8266 Arduino Core documentation
Note: to use any of file system functions in the sketch, add the ... This is because there was no mkdir() method in...
Read more >
Filesystem Home
Filesystem function specifications follow the C++ Standard Library form, ... the call to remove_all() and the call to exists() a new file or...
Read more >
FileSystem (Apache Hadoop Main 3.3.4 API)
Delete a snapshot of a directory. static void, enableSymlinks(). boolean, exists(Path f).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found