Socket
Book a DemoInstallSign in
Socket

make-symlinks

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-symlinks

Create symbolic link (file symlink) using glob

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

Travis CI node npm PRs Welcome

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:
    • patterns: <string | string[]> (required) - The source files. See globby supported patterns.
    • path: <string> (required) - The directory an output of symlink(s).
    • options: <Options>
  • Returns: <Promise<object>> - Returns a promise for an array object of symlinks patterns and path.

makeSymlinks.sync(patterns, path, [options])

  • Params:
    • patterns: <string | string[]> (required) - The source files. See globby supported patterns.
    • path: <string> (required) - The directory an output of symlink(s).
    • options: <Options>
  • 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()
  • force: <boolean> (optional) - Delete symlink if exists.
    • Default: false
  • dryRun: <boolean> (optional) - See what would be created symlinks.
    • Default: false

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);
    });
});
  • 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

Keywords

create

FAQs

Package last updated on 17 Dec 2018

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