# can-link

> Returns true if a link can be created

Latest version **3.0.0** (published 2026-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install can-link
pnpm add can-link
yarn add can-link
bun add can-link
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2026-03-11 |
| First published | 2018-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.13 |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 104 |
| Author | Zoltan Kochan <z@kochan.io> (https://www.kochan.io/) |
| Maintainers | zkochan |
| Keywords | link, hardlink |

## Links

- npm: https://www.npmjs.com/package/can-link
- Repository: https://github.com/zkochan/packages/tree/main/can-link
- Homepage: https://github.com/zkochan/packages/tree/main/can-link#readme
- npm.io page: https://npm.io/package/can-link

## Recent versions

- 3.0.0 (latest) — 2026-03-11
- 2.0.0 (next) — 2021-02-11
- 1.0.2 — 2018-02-24
- 1.0.1 — 2018-02-17
- 1.0.0 — 2018-02-17
- 0.0.0 — 2018-02-16

## README

# can-link

> Returns true if a link can be created

<!--@shields('npm')-->
[![npm version](https://img.shields.io/npm/v/can-link.svg)](https://www.npmjs.com/package/can-link)
<!--/@-->

## Installation

```sh
<npm|yarn|pnpm> add can-link
```

## Usage

```js
const canLink = require('can-link')

canLink.sync('C:\\foo.txt', 'D:\\foo.txt')
//> false

canLink.sync('C:\\foo.txt', 'C:\\dir\\foo.txt')
//> true
```

## API

### `canLink.sync(existingPath, newPath): Boolean`

Returns `true` if `fs.linkSync(existingPath, newPath)` is able to create a link.

### `canLink(existingPath, newPath): Promise<Boolean>`

Returns `true` if `fs.link(existingPath, newPath)` is able to create a link.

## License

[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io/)

---
_Source: https://npm.io/package/can-link · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
