---
title: "@vltpkg/tar: clonefile — vlt docs"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/api-reference/tar/clonefile"
image: "https://docs.vlt.io/og/client/api-reference/tar/clonefile"
lang: "en"
---

# clonefile

## Functions

### cloneAvailable()

```ts
function cloneAvailable(): boolean
```

Defined in: tar/src/clonefile.ts:106

True where [cloneDir](https://docs.vlt.io/client/api-reference/tar/clonefile.md#clonedir) can work: macOS, on a Node whose `node:ffi` loads. Being built in is not enough: the permission model without `--allow-ffi` denies it. Loads it, once.

#### Returns

`boolean`

---

### cloneDir()

```ts
function cloneDir(src, dst): string | true
```

Defined in: tar/src/clonefile.ts:115

Clone the directory `src` to `dst`, which must not exist, with `clonefile(2)`. Returns true, or the errno code of the failure: `ENOTSUP` where cloning is unavailable (not macOS, no `node:ffi`, a filesystem without clones), `EXDEV` across volumes, `ENOENT` for a missing source, and so on.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `src`     | `string` |
| `dst`     | `string` |

#### Returns

`string` | `true`
