# @types/bindings

> TypeScript definitions for bindings

Latest version **1.5.5** (published 2023-11-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/bindings
pnpm add @types/bindings
yarn add @types/bindings
bun add @types/bindings
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.5.5 |
| Published | 2023-11-20 |
| First published | 2017-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51449 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/bindings
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bindings
- npm.io page: https://npm.io/package/@types/bindings

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 1.5.5 (latest) — 2023-11-20
- 1.5.1 (ts3.6) — 2021-07-06
- 1.5.0 (ts3.3) — 2020-12-12
- 1.3.0 (ts2.0) — 2017-12-11
- 1.5.4 — 2023-11-06
- 1.5.3 — 2023-10-17
- 1.5.2 — 2023-09-14

## README

# Installation
> `npm install --save @types/bindings`

# Summary
This package contains type definitions for bindings (https://github.com/TooTallNate/node-bindings).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bindings.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bindings/index.d.ts)
````ts
/// <reference types="node"/>

/**
 * The main `bindings()` function loads the compiled bindings for a given module.
 * It uses V8's Error API to determine the parent filename that this function is
 * being invoked from, which is then used to find the root directory.
 */
declare function bindings(mod: string | bindings.Options): any;
declare namespace bindings {
    interface Options {
        /** @default process.env.NODE_BINDINGS_ARROW || ' → ' */
        arrow?: string | undefined;
        /** @default process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' */
        compiled?: string | undefined;
        /** @default process.platform */
        platform?: NodeJS.Platform | undefined;
        /** @default process.arch */
        arch?: string | undefined;
        /** @default `node-v${process.versions.modules}-${process.platform}-${process.arch}` */
        nodePreGyp?: string | undefined;
        /** @default process.versions.node */
        version?: string | undefined;
        /** @default 'bindings.node' */
        bindings?: string | undefined;
        /* @default exports.getRoot(exports.getFileName()) */
        module_root?: string | undefined;
        /* @default (build/|out/)?(Debug|Release|default) and others */
        try?: ReadonlyArray<readonly string[]> | undefined;
    }

    /**
     * Gets the filename of the JavaScript file that invokes this function.
     * Used to help find the root directory of a module.
     * Optionally accepts an filename argument to skip when searching for the invoking filename
     */
    function getFileName(calling_file?: string): string;

    /**
     * Gets the root directory of a module, given an arbitrary filename
     * somewhere in the module tree. The "root directory" is the directory
     * containing the `package.json` file.
     *
     *   In:  /home/nate/node-native-module/lib/index.js
     *   Out: /home/nate/node-native-module
     */
    function getRoot(file: string): string;
}

export = bindings;

````

### Additional Details
 * Last updated: Mon, 20 Nov 2023 23:36:23 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Daniel Perez Alvarez](https://github.com/unindented), and [ExE Boss](https://github.com/ExE-Boss).

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