https://github.com/seangenabe/shadow
Glob files to copy/symlink/hardlink to another directory.
https://github.com/seangenabe/shadow
copy filesystem fs glob hardlink link symlink
Last synced: 2 months ago
JSON representation
Glob files to copy/symlink/hardlink to another directory.
- Host: GitHub
- URL: https://github.com/seangenabe/shadow
- Owner: seangenabe
- License: mit
- Created: 2017-11-18T15:23:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:14:18.000Z (almost 3 years ago)
- Last Synced: 2024-09-17T12:36:10.532Z (about 1 year ago)
- Topics: copy, filesystem, fs, glob, hardlink, link, symlink
- Language: TypeScript
- Homepage:
- Size: 889 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# shadow
[](https://www.npmjs.com/package/@seangenabe/shadow)
[](https://travis-ci.org/seangenabe/shadow)
[](https://coveralls.io/github/seangenabe/shadow)
[](https://david-dm.org/seangenabe/shadow)
[](https://david-dm.org/seangenabe/shadow#info=devDependencies)
[](https://nodejs.org/en/download/)Glob files and copy/symlink/hardlink in another directory.
## Usage
```javascript
import { shadow } from "@seangenabe/shadow"
```### shadow(pattern, dest, opts)
Globs the current directory (`opts.cwd || process.cwd()`) and copies, symlinks, or hardlinks the globbed files with the globbed folder structure into dest.
Parameters:
* pattern - array | string - One or more [glob patterns](https://github.com/isaacs/minimatch#usage) to select the files to link
* dest - the destination directory
* opts - [options](https://github.com/sindresorhus/globby#options) to pass to `globby`
* copyMode - `'symlink' | 'link'` - Symlink or hardlink the files. If unspecified, will simply copy the files.
* fallback - Fall back to copying if there aren't enough permissions to symlink or hardlink (`EPERM`).Returns a promise that resolves when all files have been hardlinked.
## CLI
```
shadow [pattern = **]
```Options:
* cwd, dest, pattern - same as above
* -m --mode - symlink or hardlink the file
* -f --fallback - fall back to copying the file on EPERM## What happened to `hardlink`?
This package is modified from `hardlink`'s code and is a superset of its functionality.
## Related
* [copy-newer](https://github.com/seangenabe/copy-newer)
## License
MIT