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

fs-ext-extra-prebuilt

v2.2.7

Published

Fork of fs-ext with prebuilt binaries and Windows LockFileEx support.

Readme

fs-ext-extra-prebuilt

A fork of fs-ext that ships prebuilt binaries for all major platforms and adds Windows-specific file locking APIs.

Why this fork?

The original fs-ext package requires compilation during npm install, which can fail in environments without build tools. This fork:

  • Ships prebuilt binaries for macOS (x64, arm64), Linux (x64, arm64), and Windows (x64, arm64)
  • Adds LockFileEx/UnlockFileEx Windows APIs for byte-range file locking
  • Supports Node.js 20+ and Electron
  • Falls back to local compilation if no prebuilt binary matches your platform

Installation

npm install fs-ext-extra-prebuilt

Usage

const { flock, flockSync } = require('fs-ext-extra-prebuilt');
const fs = require('fs');

const fd = fs.openSync('foo.txt', 'r');
flock(fd, 'ex', (err) => {
	if (err) {
		return console.error("Couldn't lock file");
	}
	// file is locked
});

API

flock(fd, flags, [callback])

Asynchronous flock(2). No arguments other than a possible error are passed to the callback. Flags can be 'sh', 'ex', 'shnb', 'exnb', 'un' and correspond to the various LOCK_SH, LOCK_EX, LOCK_SH|LOCK_NB, etc.

NOTE (from flock() man page): flock() does not lock files over NFS. Use fcntl(2) instead: that does work over NFS, given a sufficiently recent version of Linux and a server which supports locking.

flockSync(fd, flags)

Synchronous flock(2). Throws an exception on error.

fcntl(fd, cmd, [arg], [start], [len], [callback])

Asynchronous fcntl(2).

callback will be given two arguments (err, result).

The supported commands are:

  • 'getfd' ( F_GETFD )
  • 'setfd' ( F_SETFD )
  • 'setlk' ( F_SETLK )
  • 'getlk' ( F_GETLK )
  • 'setlkw' ( F_SETLKW )

For F_SETLK and F_SETLKW, the arg parameter specifies the lock type (F_RDLCK, F_WRLCK, or F_UNLCK). The optional start and len parameters specify the byte range to lock. If omitted, they default to 0, which locks the entire file.

fcntlSync(fd, cmd, [arg], [start], [len])

Synchronous fcntl(2). Throws an exception on error.

seek(fd, offset, whence, [callback])

Asynchronous lseek(2).

callback will be given two arguments (err, currFilePos).

whence can be 0 (SEEK_SET) to set the new position in bytes to offset, 1 (SEEK_CUR) to set the new position to the current position plus offset bytes (can be negative), or 2 (SEEK_END) to set to the end of the file plus offset bytes (usually negative or zero to seek to the end of the file).

seekSync(fd, offset, whence)

Synchronous lseek(2). Throws an exception on error. Returns current file position.

lockFileEx(fd, flags, offsetLow, offsetHigh, lengthLow, lengthHigh, [callback]) - Windows only

Asynchronous LockFileEx. Locks a byte range in a file.

Flags:

  • 0 - shared lock
  • constants.LOCKFILE_EXCLUSIVE_LOCK - exclusive lock
  • constants.LOCKFILE_FAIL_IMMEDIATELY - non-blocking (can be OR'd with above)

lockFileExSync(fd, flags, offsetLow, offsetHigh, lengthLow, lengthHigh) - Windows only

Synchronous LockFileEx. Throws an exception on error.

unlockFileEx(fd, offsetLow, offsetHigh, lengthLow, lengthHigh, [callback]) - Windows only

Asynchronous UnlockFileEx. Unlocks a byte range in a file.

unlockFileExSync(fd, offsetLow, offsetHigh, lengthLow, lengthHigh) - Windows only

Synchronous UnlockFileEx. Throws an exception on error.

Constants

Available via require('fs-ext-extra-prebuilt').constants:

  • LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN - flock flags
  • F_GETFD, F_SETFD, F_GETLK, F_SETLK, F_SETLKW - fcntl commands
  • F_RDLCK, F_WRLCK, F_UNLCK - fcntl lock types
  • FD_CLOEXEC - close-on-exec flag
  • LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY - Windows LockFileEx flags

License

MIT