1 | # Installation
|
2 | > `npm install --save @types/bindings`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for bindings (https://github.com/TooTallNate/node-bindings).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bindings.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bindings/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for bindings 1.5
|
12 | // Project: https://github.com/TooTallNate/node-bindings
|
13 | // Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
|
14 | // ExE Boss <https://github.com/ExE-Boss>
|
15 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
16 |
|
17 | /// <reference types="node"/>
|
18 |
|
19 | /**
|
20 | * The main `bindings()` function loads the compiled bindings for a given module.
|
21 | * It uses V8's Error API to determine the parent filename that this function is
|
22 | * being invoked from, which is then used to find the root directory.
|
23 | */
|
24 | declare function bindings(mod: string | bindings.Options): any;
|
25 | declare namespace bindings {
|
26 | interface Options {
|
27 | /** @default process.env.NODE_BINDINGS_ARROW || ' → ' */
|
28 | arrow?: string | undefined;
|
29 | /** @default process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' */
|
30 | compiled?: string | undefined;
|
31 | /** @default process.platform */
|
32 | platform?: NodeJS.Platform | undefined;
|
33 | /** @default process.arch */
|
34 | arch?: string | undefined;
|
35 | /** @default `node-v${process.versions.modules}-${process.platform}-${process.arch}` */
|
36 | nodePreGyp?: string | undefined;
|
37 | /** @default process.versions.node */
|
38 | version?: string | undefined;
|
39 | /** @default 'bindings.node' */
|
40 | bindings?: string | undefined;
|
41 | try?: ReadonlyArray<ReadonlyArray<string>> | undefined;
|
42 | }
|
43 |
|
44 | /**
|
45 | * Gets the filename of the JavaScript file that invokes this function.
|
46 | * Used to help find the root directory of a module.
|
47 | * Optionally accepts an filename argument to skip when searching for the invoking filename
|
48 | */
|
49 | function getFileName(calling_file?: string): string;
|
50 |
|
51 | /**
|
52 | * Gets the root directory of a module, given an arbitrary filename
|
53 | * somewhere in the module tree. The "root directory" is the directory
|
54 | * containing the `package.json` file.
|
55 | *
|
56 | * In: /home/nate/node-native-module/lib/index.js
|
57 | * Out: /home/nate/node-native-module
|
58 | */
|
59 | function getRoot(file: string): string;
|
60 | }
|
61 |
|
62 | export = bindings;
|
63 |
|
64 | ````
|
65 |
|
66 | ### Additional Details
|
67 | * Last updated: Tue, 06 Jul 2021 18:05:42 GMT
|
68 | * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
69 | * Global values: none
|
70 |
|
71 | # Credits
|
72 | These definitions were written by [Daniel Perez Alvarez](https://github.com/unindented), and [ExE Boss](https://github.com/ExE-Boss).
|
73 |
|
\ | No newline at end of file |