You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

graceful-readlink

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

graceful-readlink

graceful fs.readlink


Version published
Maintainers
1
Created

Package description

What is graceful-readlink?

The graceful-readlink npm package provides a way to read symbolic links in a manner that gracefully handles errors and edge cases. It is designed to be a more robust alternative to the standard fs.readlink method in Node.js.

What are graceful-readlink's main functionalities?

Reading Symbolic Links

This feature allows you to read the target of a symbolic link synchronously. The code sample demonstrates how to use the graceful-readlink package to read a symbolic link and print its target path.

const readlink = require('graceful-readlink');
const linkPath = '/path/to/symlink';
const targetPath = readlink.sync(linkPath);
console.log(targetPath);

Graceful Error Handling

This feature ensures that errors are handled gracefully when reading symbolic links. The code sample shows how to use a try-catch block to handle potential errors that may occur during the read operation.

const readlink = require('graceful-readlink');
const linkPath = '/path/to/symlink';
try {
  const targetPath = readlink.sync(linkPath);
  console.log(targetPath);
} catch (err) {
  console.error('Error reading symbolic link:', err);
}

Other packages similar to graceful-readlink

Readme

Source

NPM Version NPM Downloads

Usage

var readlinkSync = require('graceful-readlink').readlinkSync;
console.log(readlinkSync(f));
// output
//  the file pointed to when `f` is a symbolic link
//  the `f` itself when `f` is not a symbolic link

Licence

MIT License

Keywords

FAQs

Package last updated on 12 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc