# rclonefile

> macOS API for creating copy on write clones of files

Latest version **2.0.5** (published 2025-12-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install rclonefile
pnpm add rclonefile
yarn add rclonefile
bun add rclonefile
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2025-12-26 |
| First published | 2023-02-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 24 |
| Dependencies | 0 |
| Unpacked size | 30.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 19 |
| Maintainers | sverrejoh |

## Links

- npm: https://www.npmjs.com/package/rclonefile
- Repository: https://github.com/sverrejoh/rclonefile
- Homepage: https://github.com/sverrejoh/rclonefile#readme
- Issues: https://github.com/sverrejoh/rclonefile/issues
- npm.io page: https://npm.io/package/rclonefile

## Recent versions

- 2.0.5 (latest) — 2025-12-26
- 1.0.1 — 2023-02-13

## README

# rclonefile

> The macOS API for creating copy on write clones of files.

## Description

This is a small wrapper around the
[clonefile](https://www.manpagez.com/man/2/clonefile/) API on macOS for cloning
files using the APFS file system.

## Usage

### async/await

```js

import { cloneFile } from "rclonefile";

await cloneFile("source/mario.txt", "target/mario-clone-txt");

```

### Promise

```js

import { cloneFile } from "rclonefile";

cloneFile("source/mario.txt", "target/mario-clone-txt").then(() => {
	// Success
})

```

### Sync API

```js

import { cloneFileSync } from "rclonefile";

cloneFileSync("source/mario.txt", "target/mario-clone-txt");

```

## Options

All functions accept an optional third argument with the following options:

```ts
interface CloneFileOptions {
  noFollow?: boolean;    // Don't follow symlinks, clone the link itself
  noOwnerCopy?: boolean; // Don't copy ownership information
  cloneAcl?: boolean;    // Clone ACL (Access Control List) information
}
```

### Example with options

```js
import { cloneFile } from "rclonefile";

// Clone a symlink as a symlink (don't follow it)
await cloneFile("source/link.txt", "target/link.txt", { noFollow: true });

// Clone without copying ownership
await cloneFile("source/file.txt", "target/file.txt", { noOwnerCopy: true });
```

## Links

- [rclonefile-cli](https://github.com/sverrejoh/rclonefile-cli) - CLI for this module
- [clonefile(2)](https://www.manpagez.com/man/2/clonefile/) - Man page for system API

---
_Source: https://npm.io/package/rclonefile · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
