# native-file-monopolist

> Open a file handle exclusively and hold it, in order to other processes cannot access the file.

Latest version **0.3.0** (published 2020-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install native-file-monopolist
pnpm add native-file-monopolist
yarn add native-file-monopolist
bun add native-file-monopolist
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2020-07-03 |
| First published | 2020-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Author | Dingping Zhang |
| Maintainers | dingpingzhang |
| Keywords | native, file-system, win, win32-api, c++ |

## Links

- npm: https://www.npmjs.com/package/native-file-monopolist
- Repository: https://github.com/DingpingZhang/native-file-monopolist
- Issues: https://github.com/DingpingZhang/native-file-monopolist/issues
- npm.io page: https://npm.io/package/native-file-monopolist

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2020-07-03
- 0.2.0 — 2020-07-02
- 0.1.1 — 2020-07-01

## README

# Native File Monopolist

Open a file handle exclusively and hold it, in order to other processes cannot access the file.

## Install

```console
npm install native-file-monopolist
```

Or

```console
yarn add native-file-monopolist
```

## Build

```console
yarn configure
yarn build
```

## Test

```console
yarn test
```

## Use

```js
import { FileMonopolist } from 'native-file-monopolist';

const filePath = 'C:\\your-file-path';
const monopolist = new FileMonopolist(filePath);

console.log(monopolist.monopolized); // false
console.log(monopolist.filePath); // 'C:\\your-file-path'

const errorCode = monopolist.monopolize();
assert(errorCode === 0);

console.log(monopolist.monopolized); // true
const success = monopolist.dispose(); // true
console.log(monopolist.monopolized); // false
```

## API

See [`index.d.ts`](./index.d.ts) file for details.

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