lnk-cli

Create links between files cross-platform

Usage no npm install needed!

<script type="module">
  import lnkCli from 'https://cdn.skypack.dev/lnk-cli';
</script>

README

lnk-cli Build Status Build status Coverage Status XO code style

Create links between files cross-platform

Why

  • Create hard links, directory junctions and symbolic links depending on the platform

Install

$ [sudo] npm install lnk-cli --global

Usage

$ tree
.
└── assets
    ├── favicon.ico
    └── style
        ├── app.css
        └── vendor.css

2 directories, 3 files
$ lnk assets/favicon.ico assets/style dist

# or using bash globs
$ lnk assets/* dist
$ tree
.
├── assets
│   ├── favicon.ico
│   └── style
│       ├── app.css
│       └── vendor.css
└── dist
    ├── favicon.ico              // hard link to assets/favicon.ico
    └── style -> ../assets/style // symlink; directory junction on windows

4 directories, 4 files

Glob support

lnk don't support globbing by itself, for platform independent glob support use globstar:

$ npm install globstar --global

$ globstar -- lnk "assets/*" dist

Please note that Windows needs double quotes, especially if you want to use it in your package.json:

  "scripts": {
    "link-assets": "globstar --node -- lnk \"assets/*\" dist",
  },

Related

  • lnk – API version of this project
  • globstar – if you need glob/globstar support, especially on Windows
  • cpy-cli – if you need to copy multiple files
  • del-cli – if you need to delete files and folders

License

MIT © Michael Mayer