# @esfx/disposable

> A low-level API for defining explicit resource management.

Latest version **1.0.0** (published 2022-10-20) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @esfx/disposable
pnpm add @esfx/disposable
yarn add @esfx/disposable
bun add @esfx/disposable
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-10-20 |
| First published | 2019-05-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 233.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 234 |
| Author | Ron Buckton |
| Maintainers | rbuckton |

## Links

- npm: https://www.npmjs.com/package/@esfx/disposable
- Repository: https://github.com/esfx/esfx
- Homepage: https://github.com/esfx/esfx#readme
- Issues: https://github.com/esfx/esfx/issues
- npm.io page: https://npm.io/package/@esfx/disposable

## Recent versions

- 1.0.0 (latest) — 2022-10-20
- 1.1.0-alpha.202307260322 (next) — 2023-07-26
- 1.0.0-dev.8 (dev) — 2022-10-20
- 1.1.0-alpha.202306080253 — 2023-06-08
- 1.1.0-alpha.202306061406 — 2023-06-06
- 1.1.0-alpha.202306061316 — 2023-06-06
- 1.1.0-alpha.202306051228 — 2023-06-05
- 1.1.0-alpha.202305082104 — 2023-05-08
- 1.1.0-alpha.202302091715 — 2023-02-09
- 1.1.0-alpha.202302071935 — 2023-02-07
- 1.1.0-alpha.202211291446 — 2022-11-29
- 1.1.0-alpha.202211221509 — 2022-11-22
- 1.1.0-alpha.202210252139 — 2022-10-25
- 1.0.0-dev.7 — 2022-10-20
- 1.0.0-dev.6 — 2022-10-19
- … 38 more at https://npm.io/package/@esfx/disposable/versions

## README

# `@esfx/disposable`

The `@esfx/disposable` package provides a low-level API for defining explicit resource management that third-party libraries can use to interoperate.

# Overview

* [Installation](#installation)
* [Usage](#usage)
* [API](#api)

# Installation

```sh
npm i @esfx/disposable
```

# Usage

```ts
import { Disposable } from "@esfx/disposable";

class MyFileResouce {
    constructor() {
        this.handle = fs.openSync("path/to/file");
    }

    close() {
        fs.closeSync(this.handle);
        this.handle = undefined;
    }

    // provide low-level 'dispose' primitive for interop
    [Disposable.dispose]() {
        this.close();
    }
}
```

# API

You can read more about the API [here](https://esfx.js.org/esfx/api/disposable.html).

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