make-symlinks
v2.0.1
Published
Create symbolic link (file symlink) using glob
Downloads
345
Maintainers
Readme
make-symlinks
Create symbolic link (file symlink) using glob
Install
$ npm install make-symlinks
Usage
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:
- Returns:
<Promise<object>>
- Returns a promise for an array object of symlinks patterns and path.
makeSymlinks.sync(patterns
, path
, [options]
)
- Params:
- Returns:
<Promise<object>>
- Returns an array object of symlinks patterns and path.
Options
See all supported globby
options.
cwd
:<string>
(optional) - The source files to resolve from.- Default:
process.cwd()
- Default:
force
:<boolean>
(optional) - Delete symlink if exists.- Default:
false
- Default:
dryRun
:<boolean>
(optional) - See what would be created symlinks.- Default:
false
- Default:
Example
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 - Create or delete symbolic link using glob on CLI.
- del-symlinks - Delete symlinks using glob.
- get-symlinks - Get all symbolic link (file symlinks) using glob.
License
MIT © Guntur Poetra