-
-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathShare.ts
More file actions
60 lines (51 loc) · 2.04 KB
/
Share.ts
File metadata and controls
60 lines (51 loc) · 2.04 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
51
52
53
54
55
56
57
58
59
60
/**
* Copyright (c) Jonathan Cardoso Machado. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import './moduleSetup'
import { CurlShareCode } from './enum/CurlCode'
import { CurlShareOption } from './enum/CurlShareOption'
import { CurlShareLock } from './enum/CurlShareLock'
/**
* `Share` class that acts as an wrapper around the native libcurl share handle.
* > [C++ source code](https://github.com/JCMais/node-libcurl/blob/master/src/Share.cc)
*
* Using this class you should be able to share data between
* two {@link Easy | Easy} handles, like cookies for instance.
*
* For usage see [examples/05-share.js](https://github.com/JCMais/node-libcurl/blob/master/examples/05-share.js)
*
* @public
*/
// @ts-expect-error - we are abusing TS merging here to have sane types for the addon classes
declare class Share {
/**
* You can use {@link CurlShareOption|`CurlShareOption`} and {@link CurlShareLock|`CurlShareLock`}
* for predefined constants.
*
* Official libcurl documentation: [`curl_share_setopt()`](http://curl.haxx.se/libcurl/c/curl_share_setopt.html)
*/
setOpt(option: CurlShareOption, value: CurlShareLock): CurlShareCode
/**
* Closes this handle.
*
* After the handle has been closed it must not be used again.
*
* This is basically the same than [curl_share_cleanup()](http://curl.haxx.se/libcurl/c/curl_share_cleanup.html)
*/
close(): void
// below ones are duplicated from below
// just so that it also appears on the documentation for this class
/**
* Returns a description for the given error code.
*
* Official libcurl documentation: [`curl_share_strerror()`](http://curl.haxx.se/libcurl/c/curl_share_strerror.html)
*/
strError(errorCode: CurlShareCode): string
}
const bindings: any = require('../lib/binding/node_libcurl.node')
// @ts-expect-error - we are abusing TS merging here to have sane types for the addon classes
const Share = bindings.Share as Share
export { Share }