forked from lucksoft-yungui/luck-node-mtp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.d.ts
150 lines (134 loc) · 3.76 KB
/
main.d.ts
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
declare module 'luck-node-mtp' {
interface ListObject {
name: string,
size: number,
type: string,
id: number,
modificationdate: number,
parent_id: number,
storage_id: number,
}
interface DeviceInfo {
vendor: string,
vendor_id: number,
product: string,
product_id: number
}
interface StorageInfo {
id: number,
StorageDescription: string,
VolumeIdentifier: string,
}
/**
* Connect to a device.
*
* @param {number} vendorId
* @param {number} productId
*
* @return {boolean}
*/
export function connect(vendorId?: number, productId?: number): boolean;
/**
* Release the currently connected device.
*
* @return {boolean}
*/
export function release(): boolean;
/**
* Get a list of objects within a given mtp device parent path. A file tree can be build by using this method.
*
* @param {string} parentPath
*
* @return {Array.<ListObject>}
*/
export function getList(parentPath: string): [ListObject];
/**
* Returns a list of valid connected devices.
*
* @return {Array.<DeviceInfo>}
*/
export function getDeviceInfo(): [DeviceInfo];
/**
* Upload a file to the MTP device.
*
* @param {string} sourcePath
* @param {string} targetPath
* @param {Function} callback
*
* @return {boolean}
*/
export function upload(sourcePath: string, targetPath: string, callback?: Function): boolean;
/**
* This function deletes a single file, track, playlist, folder or any other object from the MTP device, identified by the object ID.
*
* @param {string} sourcePath
* @param {string} targetPath
* @param {Function} callback
*
* @return {boolean}
*/
export function del(sourcePath: string, targetPath: string, callback?: Function): boolean;
/**
* Obtain information about an object on the device.
*
* @param {string} targetPath
*
* @return {ListObject}
*/
export function getObject(targetPath: string): ListObject;
/**
* Copy a file from one place on the device to another place on the device.
*
* @param {string} sourcePath
* @param {string} targetPath
*
* @return {boolean}
*/
export function copy(sourcePath: string, targetPath: string): boolean;
/**
* Move a file from one place on the device to another place on the device.
*
* @param {string} sourcePath
* @param {string} targetPath
*
* @return {boolean}
*/
export function copy(sourcePath: string, targetPath: string): boolean;
/**
* Set the file name of an object on the device.
* @param {string} sourcePath
* @param {string} filename
*
* @return {boolean}
*/
export function setFileName(sourcePath: string, filename: string): boolean;
/**
* Set the name of a folder on the device.
*
* @param {string} sourcePath
* @param {string} foldername
*
* @return {boolean}
*/
export function setFolderName(sourcePath: string, foldername: string): boolean;
/**
* Create a folder on the device.
*
* @return {number} The object id of the new folder.
*/
export function createFolder(targetPath: string, foldername: string): number;
/**
* Get the storage information of the currently connected device.
*
* @return {StorageInfo}
*/
export function getCurrentDeviceStorageInfo(): [StorageInfo];
/**
* Select the device storage for the currently connected device.
*
* @param {number} storageId
*
* @return {boolean}
*/
export function setStorage(storageId: number): boolean;
}