1# gentle-fs [](https://npm.im/gentle-fs) [](https://npm.im/gentle-fs) [](https://travis-ci.org/npm/gentle-fs) [](https://ci.appveyor.com/project/npm/gentle-fs) [](https://coveralls.io/github/npm/gentle-fs?branch=latest) 2 3[`gentle-fs`](https://github.com/npm/gentle-fs) is a standalone library for 4"gently" remove or link directories. 5 6## Install 7 8`$ npm install gentle-fs` 9 10## Table of Contents 11 12* [Example](#example) 13* [Features](#features) 14* [API](#api) 15 * [`rm`](#rm) 16 * [`link`](#link) 17 * [`linkIfExists`](#linkIfExists) 18 19### Example 20 21```javascript 22// todo 23``` 24 25### Features 26 27* Performs filesystem operations "gently". Please see details in the API specs below 28for a more precise definition of "gently". 29 30### API 31 32#### <a name="rm"></a> `> rm(target, opts, cb)` 33 34Will delete all directories between `target` and `opts.base`, as long as they are empty. 35That is, if `target` is `/a/b/c/d/e` and `base` is `/a/b`, but `/a/b/c` has other files 36besides the `d` directory inside of it, `/a/b/c` will remain. 37 38##### Example 39 40```javascript 41rm(target, opts, cb) 42``` 43 44#### <a name="link"></a> `> link(from, to, opts, cb)` 45 46If `from` is a real directory, and `from` is not the same directory as `to`, will 47symlink `from` to `to`, while also gently [`rm`](#rm)ing the `to` directory, 48and then call the callback. Otherwise, will call callback with an `Error`. 49 50##### Example 51 52```javascript 53link(from, to, opts, cb) 54``` 55 56#### <a name="linkIfExists"></a> `> linkIfExists(from, to, opts, cb)` 57 58Performs the same operation as [`link`](#link), except does nothing when `from` is the 59same as `to`, and calls the callback. 60 61##### Example 62 63```javascript 64linkIfExists(from, to, opts, cb) 65``` 66