npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kexi/vibe-native

v0.19.1

Published

Native clone operations for vibe CLI (clonefile on macOS, FICLONE on Linux)

Readme

@kexi/vibe-native

Native Copy-on-Write (CoW) file cloning for Node.js using Rust (napi-rs).

Features

  • macOS: Uses clonefile() syscall on APFS filesystems
  • Linux: Uses FICLONE ioctl on Btrfs/XFS filesystems
  • Zero-copy: Creates instant file clones without copying data
  • Async/Sync: Both async and sync APIs available
  • Type-safe: Full TypeScript support with auto-generated types

Installation

npm install @kexi/vibe-native
# or
pnpm add @kexi/vibe-native

Platform Support

| Platform | Architecture | Filesystem | | -------- | ------------ | ------------------------- | | macOS | x64, arm64 | APFS | | Linux | x64, arm64 | Btrfs, XFS (with reflink) |

Usage

import {
  cloneAsync,
  cloneSync,
  isAvailable,
  supportsDirectory,
  getPlatform,
} from "@kexi/vibe-native";

// Check if native cloning is available
if (isAvailable()) {
  console.log(`Platform: ${getPlatform()}`);
  console.log(`Directory cloning: ${supportsDirectory()}`);

  // Async cloning (recommended)
  await cloneAsync("/path/to/source", "/path/to/dest");

  // Sync cloning
  cloneSync("/path/to/source", "/path/to/dest");
}

API

cloneAsync(src: string, dest: string): Promise<void>

Clone a file or directory asynchronously using native Copy-on-Write.

cloneSync(src: string, dest: string): void

Clone a file or directory synchronously using native Copy-on-Write.

clone(src: string, dest: string): void

Alias for cloneSync (for backward compatibility).

isAvailable(): boolean

Check if native clone operations are available on the current platform.

supportsDirectory(): boolean

Check if directory cloning is supported:

  • macOS (clonefile): true
  • Linux (FICLONE): false (files only)

getPlatform(): "darwin" | "linux" | "unknown"

Get the current platform identifier.

Security

File Type Validation

Only regular files and directories are allowed. The following are rejected:

  • Symlinks (to prevent path traversal)
  • Device files (block/character devices)
  • Sockets
  • FIFOs (named pipes)

Path Handling

This library does not perform path normalization or validation. Callers should:

  • Validate paths before calling clone functions
  • Use path.resolve() to normalize relative paths
  • Check for symlinks if path traversal is a concern
import { resolve, dirname } from "path";
import { realpath } from "fs/promises";

// Example: Safe path handling
async function safeClone(src: string, dest: string, allowedDir: string) {
  const resolvedSrc = await realpath(resolve(src));
  const resolvedDest = resolve(dest);

  // Verify paths are within allowed directory
  if (!resolvedSrc.startsWith(allowedDir)) {
    throw new Error("Source path outside allowed directory");
  }
  if (!resolvedDest.startsWith(allowedDir)) {
    throw new Error("Destination path outside allowed directory");
  }

  await cloneAsync(resolvedSrc, resolvedDest);
}

Error Handling

Errors include system errno information for debugging:

try {
  await cloneAsync("/nonexistent", "/dest");
} catch (error) {
  // Error: open source failed: No such file or directory (errno 2)
  console.error(error.message);
}

Filesystem Requirements

macOS

  • APFS is required for clonefile() to work
  • HFS+ and other filesystems will return ENOTSUP

Linux

  • Btrfs or XFS (with reflink support) is required
  • ext4 and other filesystems will return EOPNOTSUPP

Building from Source

# Install dependencies
pnpm install

# Build (requires Rust toolchain)
pnpm run build

# Run tests
cargo test

License

Apache-2.0