Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iguntur/make-symlinks
Create symbolic link (file symlink) using glob
https://github.com/iguntur/make-symlinks
fs glob links makesymlinks patterns symbolic symlink
Last synced: about 11 hours ago
JSON representation
Create symbolic link (file symlink) using glob
- Host: GitHub
- URL: https://github.com/iguntur/make-symlinks
- Owner: iguntur
- License: mit
- Created: 2016-10-11T03:14:27.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-17T17:19:37.000Z (almost 6 years ago)
- Last Synced: 2024-06-21T15:45:53.522Z (5 months ago)
- Topics: fs, glob, links, makesymlinks, patterns, symbolic, symlink
- Language: TypeScript
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# make-symlinks
[![Travis CI](https://img.shields.io/travis/iguntur/make-symlinks.svg?style=flat-square)](https://travis-ci.org/iguntur/make-symlinks)
[![node](https://img.shields.io/node/v/make-symlinks.svg?style=flat-square)](#)
[![npm](https://img.shields.io/npm/v/make-symlinks.svg?style=flat-square)](https://www.npmjs.org/package/make-symlinks)
[![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-1e9eff.svg?style=flat-square)](http://makeapullrequest.com)> Create symbolic link (file symlink) using glob
---
## Install
```console
$ npm install make-symlinks
```## Usage
```js
const makeSymlinks = require('make-symlinks');const patterns = ['/home/guntur/dotfiles/*', '!/home/guntur/dotfiles/.git'];
const path = '/home/guntur/';makeSymlinks(patterns, path).then(symlinks => {
symlinks.forEach(symlink => {
console.log(symlink.path, '→', symlink.target);
});
});const symlinks = makeSymlinks.sync(patterns, path);
symlinks.forEach(symlink => {
console.log(symlink.path, '→', symlink.target);
});
```## API
### makeSymlinks(`patterns`, `path`, `[options]`)
- Params:
- `patterns`: `` _(required)_ - The source files. See [`globby`](https://github.com/sindresorhus/globby#patterns) supported patterns.
- `path`: `` _(required)_ - The directory an output of symlink(s).
- `options`: [``](#options)
- Returns: `>` - Returns a promise for an array object of symlinks patterns and path.### makeSymlinks.sync(`patterns`, `path`, `[options]`)
- Params:
- `patterns`: `` _(required)_ - The source files. See [`globby`](https://github.com/sindresorhus/globby#patterns) supported patterns.
- `path`: `` _(required)_ - The directory an output of symlink(s).
- `options`: [``](#options)
- Returns: `>` - Returns an array object of symlinks patterns and path.#### Options
See all supported [`globby`](https://github.com/sindresorhus/globby#options) options.
- `cwd`: `` _(optional)_ - The source files to resolve from.
- Default: `process.cwd()`
- `force`: `` _(optional)_ - Delete symlink if exists.
- Default: `false`
- `dryRun`: `` _(optional)_ - See what would be created symlinks.
- Default: `false`**Example**
```js
const options = {
cwd: process.env.HOME,
dryRun: true
};makeSymlinks('**/*', '/path/symlinks/dest', options).then(symlinks => {
symlinks.forEach(symlink => {
console.log(symlink.path, '→', symlink.target);
});
});
```## Related
- [ln-cli](https://github.com/iguntur/ln-cli) - Create or delete symbolic link using glob on CLI.
- [del-symlinks](https://github.com/iguntur/del-symlinks) - Delete symlinks using glob.
- [get-symlinks](https://github.com/iguntur/get-symlinks) - Get all symbolic link (file symlinks) using glob.## License
MIT © [Guntur Poetra](https://github.com/iguntur)