forked from TooTallNate/ref-array
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.d.ts
More file actions
50 lines (43 loc) · 1.48 KB
/
Copy pathindex.d.ts
File metadata and controls
50 lines (43 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Type definitions for ref-array-napi
// Project: https://github.com/Janealter/ref-array-napi
// Definitions by: goooseman <https://github.com/goooseman>
// Used definitions by: Paul Loyd <https://github.com/loyd>
// TypeScript Version: 3.7
import ref = require('ref-napi');
interface ArrayTypeInstance<T> {
[i: number]: T;
length: number;
toArray(): T[];
toJSON(): T[];
inspect(): string;
buffer: Buffer;
ref(): Buffer;
}
interface ArrayType<T> extends ref.Type {
BYTES_PER_ELEMENT: number;
fixedLength: number;
/** The reference to the base type. */
type: ref.Type;
/**
* Accepts a Buffer instance that should be an already-populated with data
* for the ArrayType. The "length" of the Array is determined by searching
* through the buffer's contents until an aligned NULL pointer is encountered.
*/
untilZeros(buffer: Buffer): ArrayTypeInstance<T>;
new (length?: number): ArrayTypeInstance<T>;
new (data: number[], length?: number): ArrayTypeInstance<T>;
new (data: Buffer, length?: number): ArrayTypeInstance<T>;
(length?: number): ArrayTypeInstance<T>;
(data: number[], length?: number): ArrayTypeInstance<T>;
(data: Buffer, length?: number): ArrayTypeInstance<T>;
}
/**
* The array type meta-constructor.
* The returned constructor's API is highly influenced by the WebGL
* TypedArray API.
*/
declare const ArrayType: {
<T>(type: ref.Type, length?: number): ArrayType<T>;
<T>(type: string, length?: number): ArrayType<T>;
};
export = ArrayType;