@jesusacd/mediafire 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +306 -123
- package/dist/client.d.ts +12 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/files.d.ts +101 -0
- package/dist/modules/files.d.ts.map +1 -1
- package/dist/modules/files.js +185 -0
- package/dist/modules/files.js.map +1 -1
- package/dist/modules/folders.d.ts +118 -0
- package/dist/modules/folders.d.ts.map +1 -1
- package/dist/modules/folders.js +198 -0
- package/dist/modules/folders.js.map +1 -1
- package/dist/modules/upload.d.ts +115 -0
- package/dist/modules/upload.d.ts.map +1 -0
- package/dist/modules/upload.js +276 -0
- package/dist/modules/upload.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,183 +1,366 @@
|
|
|
1
1
|
# @jesusacd/mediafire
|
|
2
2
|
|
|
3
|
-
SDK
|
|
3
|
+
Complete MediaFire SDK for Node.js. **Just use your email and password** to access all API features.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@jesusacd/mediafire)
|
|
6
|
+
|
|
7
|
+
## ✨ Features
|
|
8
|
+
|
|
9
|
+
- 🔐 **Simple Authentication** - Just email and password, no API keys needed
|
|
10
|
+
- 📁 **Full Management** - Files and folders (create, move, copy, delete)
|
|
11
|
+
- 📤 **File Upload** - Supports large files
|
|
12
|
+
- 🔍 **Search** - Search files in your account
|
|
13
|
+
- 🔗 **Direct Links** - Get download URLs
|
|
14
|
+
- 📊 **TypeScript** - Full type definitions included
|
|
15
|
+
|
|
16
|
+
## 📦 Installation
|
|
6
17
|
|
|
7
18
|
```bash
|
|
8
19
|
npm install @jesusacd/mediafire
|
|
9
20
|
```
|
|
10
21
|
|
|
11
|
-
## Quick Start
|
|
22
|
+
## 🚀 Quick Start
|
|
12
23
|
|
|
13
|
-
```
|
|
14
|
-
|
|
24
|
+
```javascript
|
|
25
|
+
const { MediaFireClient } = require("@jesusacd/mediafire");
|
|
15
26
|
|
|
16
27
|
const client = new MediaFireClient();
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
async function main() {
|
|
30
|
+
// Just email and password - that's it!
|
|
31
|
+
await client.login("your-email@example.com", "your-password");
|
|
20
32
|
|
|
21
|
-
//
|
|
22
|
-
const user = await client.user.getInfo();
|
|
23
|
-
console.log(
|
|
33
|
+
// Get user info
|
|
34
|
+
const user = await client.user.getInfo();
|
|
35
|
+
console.log(`Hello, ${user.displayName}!`);
|
|
24
36
|
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
console.log(`
|
|
37
|
+
// Upload a file
|
|
38
|
+
const result = await client.upload.file("./my-file.pdf");
|
|
39
|
+
console.log(`Uploaded: ${result.quickKey}`);
|
|
28
40
|
|
|
29
|
-
//
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
// Get download link
|
|
42
|
+
const links = await client.files.getLinks(result.quickKey);
|
|
43
|
+
console.log(`Link: ${links.directDownload}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
main();
|
|
34
47
|
```
|
|
35
48
|
|
|
36
|
-
## API Reference
|
|
49
|
+
## 📚 API Reference
|
|
37
50
|
|
|
38
|
-
###
|
|
51
|
+
### Authentication
|
|
39
52
|
|
|
40
|
-
```
|
|
53
|
+
```javascript
|
|
41
54
|
const client = new MediaFireClient();
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### Métodos de Autenticación
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
// Login
|
|
48
|
-
const session = await client.login(email, password);
|
|
49
55
|
|
|
50
|
-
//
|
|
51
|
-
client.
|
|
56
|
+
// Login with email and password
|
|
57
|
+
await client.login("email@example.com", "password");
|
|
52
58
|
|
|
53
|
-
//
|
|
54
|
-
client.
|
|
59
|
+
// Check if authenticated
|
|
60
|
+
client.isAuthenticated(); // true
|
|
55
61
|
|
|
56
|
-
//
|
|
62
|
+
// Get session data
|
|
57
63
|
const session = client.getSession();
|
|
64
|
+
|
|
65
|
+
// Restore previous session
|
|
58
66
|
client.setSession(session);
|
|
67
|
+
|
|
68
|
+
// Logout
|
|
69
|
+
client.logout();
|
|
59
70
|
```
|
|
60
71
|
|
|
61
|
-
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 👤 User Module
|
|
62
75
|
|
|
63
|
-
```
|
|
64
|
-
//
|
|
76
|
+
```javascript
|
|
77
|
+
// User information
|
|
65
78
|
const user = await client.user.getInfo();
|
|
66
|
-
// {
|
|
79
|
+
// { displayName, email, firstName, lastName, gender, birthDate, premium, emailVerified, createdAt }
|
|
67
80
|
|
|
68
|
-
//
|
|
81
|
+
// Storage info
|
|
69
82
|
const storage = await client.user.getStorage();
|
|
70
|
-
// {
|
|
83
|
+
// { used, total, usedFormatted: "500 MB", totalFormatted: "10 GB", percentUsed: 5 }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### 📁 Folders Module
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
// List folder contents
|
|
92
|
+
const content = await client.folders.getContent("folderKey");
|
|
93
|
+
// { items: [...], moreChunks, chunkNumber }
|
|
94
|
+
|
|
95
|
+
// Get only files
|
|
96
|
+
const files = await client.folders.getFiles("folderKey");
|
|
97
|
+
|
|
98
|
+
// Get only folders
|
|
99
|
+
const folders = await client.folders.getFolders("folderKey");
|
|
100
|
+
|
|
101
|
+
// Get folder info
|
|
102
|
+
const info = await client.folders.getInfo("folderKey");
|
|
103
|
+
// { folderKey, name, description, created, privacy, fileCount, folderCount, totalSize }
|
|
104
|
+
|
|
105
|
+
// Create folder
|
|
106
|
+
const newFolder = await client.folders.create("My Folder", "parentKey");
|
|
107
|
+
// { folderKey, name }
|
|
108
|
+
|
|
109
|
+
// Rename folder
|
|
110
|
+
await client.folders.rename("folderKey", "New Name");
|
|
111
|
+
|
|
112
|
+
// Move to another folder
|
|
113
|
+
await client.folders.move("folderKey", "destFolderKey");
|
|
114
|
+
|
|
115
|
+
// Copy folder
|
|
116
|
+
const newKey = await client.folders.copy("folderKey", "destFolderKey");
|
|
117
|
+
|
|
118
|
+
// Change privacy
|
|
119
|
+
await client.folders.setPrivacy("folderKey", "public"); // or 'private'
|
|
120
|
+
|
|
121
|
+
// Delete (move to trash)
|
|
122
|
+
await client.folders.delete("folderKey");
|
|
123
|
+
|
|
124
|
+
// Permanently delete
|
|
125
|
+
await client.folders.purge("folderKey");
|
|
71
126
|
```
|
|
72
127
|
|
|
73
|
-
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### 📄 Files Module
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
// Get file info
|
|
134
|
+
const fileInfo = await client.files.getInfo("quickKey");
|
|
135
|
+
// { quickKey, name, size, sizeFormatted, hash, created, privacy, mimeType, ... }
|
|
136
|
+
|
|
137
|
+
// Get links
|
|
138
|
+
const links = await client.files.getLinks("quickKey");
|
|
139
|
+
// { viewLink, normalDownload, directDownload }
|
|
140
|
+
|
|
141
|
+
// Search files
|
|
142
|
+
const results = await client.files.search("document");
|
|
143
|
+
// { files: [...], total }
|
|
144
|
+
|
|
145
|
+
// Change privacy
|
|
146
|
+
await client.files.setPrivacy("quickKey", "public");
|
|
147
|
+
await client.files.makePublic("quickKey"); // Shortcut
|
|
148
|
+
await client.files.makePrivate("quickKey"); // Shortcut
|
|
149
|
+
|
|
150
|
+
// Rename file
|
|
151
|
+
await client.files.rename("quickKey", "new-name.pdf");
|
|
152
|
+
|
|
153
|
+
// Move to another folder
|
|
154
|
+
await client.files.move("quickKey", "folderKey");
|
|
155
|
+
|
|
156
|
+
// Copy file
|
|
157
|
+
const newKeys = await client.files.copy("quickKey", "folderKey");
|
|
158
|
+
|
|
159
|
+
// Delete (move to trash)
|
|
160
|
+
await client.files.delete("quickKey");
|
|
161
|
+
|
|
162
|
+
// Restore from trash
|
|
163
|
+
await client.files.restore("quickKey");
|
|
74
164
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const file = await client.files.getInfo("quickkey");
|
|
78
|
-
// { quickKey, name, size, sizeFormatted, mimeType, downloads, privacy }
|
|
165
|
+
// Permanently delete
|
|
166
|
+
await client.files.purge("quickKey");
|
|
79
167
|
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
// { directDownload, normalDownload, viewLink }
|
|
168
|
+
// Get file versions
|
|
169
|
+
const versions = await client.files.getVersions("quickKey");
|
|
83
170
|
|
|
84
|
-
//
|
|
85
|
-
const
|
|
86
|
-
// { query, items, total }
|
|
171
|
+
// Get recently modified files
|
|
172
|
+
const recent = await client.files.getRecentlyModified();
|
|
87
173
|
```
|
|
88
174
|
|
|
89
|
-
|
|
175
|
+
---
|
|
90
176
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
chunkSize: 100,
|
|
177
|
+
### 📤 Upload Module
|
|
178
|
+
|
|
179
|
+
```javascript
|
|
180
|
+
// Upload file from disk
|
|
181
|
+
const result = await client.upload.file("./file.pdf", {
|
|
182
|
+
folderKey: "destFolderKey", // Optional: destination folder
|
|
183
|
+
actionOnDuplicate: "keep", // 'skip' | 'keep' | 'replace'
|
|
99
184
|
});
|
|
100
|
-
// {
|
|
185
|
+
// { quickKey, filename, size, uploadKey }
|
|
101
186
|
|
|
102
|
-
//
|
|
103
|
-
const
|
|
187
|
+
// Upload from Buffer
|
|
188
|
+
const buffer = Buffer.from("File content");
|
|
189
|
+
const result = await client.upload.buffer(buffer, "file.txt", {
|
|
190
|
+
folderKey: "destFolderKey",
|
|
191
|
+
});
|
|
104
192
|
|
|
105
|
-
//
|
|
106
|
-
const
|
|
193
|
+
// Check if file exists (for instant upload)
|
|
194
|
+
const check = await client.upload.check(sha256Hash, "file.pdf", fileSize);
|
|
195
|
+
// { hashExists, inAccount, inFolder, duplicateQuickKey }
|
|
196
|
+
|
|
197
|
+
// Instant upload (if file already exists on MediaFire)
|
|
198
|
+
const result = await client.upload.instant(
|
|
199
|
+
sha256Hash,
|
|
200
|
+
"file.pdf",
|
|
201
|
+
fileSize,
|
|
202
|
+
"folderKey",
|
|
203
|
+
);
|
|
107
204
|
```
|
|
108
205
|
|
|
109
|
-
|
|
206
|
+
---
|
|
110
207
|
|
|
111
|
-
|
|
112
|
-
import { MediaFireClient, MediaFireError } from "@jesusacd/mediafire";
|
|
208
|
+
## 💡 Usage Examples
|
|
113
209
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
210
|
+
### Upload multiple files
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
const files = ["doc1.pdf", "doc2.pdf", "image.png"];
|
|
214
|
+
|
|
215
|
+
for (const file of files) {
|
|
216
|
+
const result = await client.upload.file(file);
|
|
217
|
+
console.log(`✅ ${file} -> ${result.quickKey}`);
|
|
121
218
|
}
|
|
122
219
|
```
|
|
123
220
|
|
|
124
|
-
|
|
221
|
+
### Create folder structure
|
|
125
222
|
|
|
126
|
-
```
|
|
127
|
-
|
|
223
|
+
```javascript
|
|
224
|
+
// Create main folder
|
|
225
|
+
const main = await client.folders.create("Project 2024");
|
|
128
226
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// Archivos raíz
|
|
153
|
-
console.log(`\n📂 Carpeta raíz:`);
|
|
154
|
-
const content = await client.folders.getContent();
|
|
155
|
-
content.items.forEach((item) => {
|
|
156
|
-
const icon = item.isFolder ? "📁" : "📄";
|
|
157
|
-
const size = item.isFolder ? "" : ` (${(item as any).sizeFormatted})`;
|
|
158
|
-
console.log(` ${icon} ${item.name}${size}`);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// Búsqueda
|
|
162
|
-
console.log(`\n🔍 Buscando archivos...`);
|
|
163
|
-
const results = await client.files.search("test");
|
|
164
|
-
console.log(` Encontrados: ${results.total} archivos`);
|
|
165
|
-
} catch (error) {
|
|
166
|
-
if (error instanceof MediaFireError) {
|
|
167
|
-
console.error(`❌ Error de MediaFire: ${error.message}`);
|
|
168
|
-
} else {
|
|
169
|
-
throw error;
|
|
227
|
+
// Create subfolders
|
|
228
|
+
await client.folders.create("Documents", main.folderKey);
|
|
229
|
+
await client.folders.create("Images", main.folderKey);
|
|
230
|
+
await client.folders.create("Videos", main.folderKey);
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Backup local folder
|
|
234
|
+
|
|
235
|
+
```javascript
|
|
236
|
+
const fs = require("fs");
|
|
237
|
+
const path = require("path");
|
|
238
|
+
|
|
239
|
+
async function backupFolder(localPath, remoteFolderKey) {
|
|
240
|
+
const files = fs.readdirSync(localPath);
|
|
241
|
+
|
|
242
|
+
for (const file of files) {
|
|
243
|
+
const filePath = path.join(localPath, file);
|
|
244
|
+
|
|
245
|
+
if (fs.statSync(filePath).isFile()) {
|
|
246
|
+
const result = await client.upload.file(filePath, {
|
|
247
|
+
folderKey: remoteFolderKey,
|
|
248
|
+
});
|
|
249
|
+
console.log(`✅ ${file} uploaded`);
|
|
170
250
|
}
|
|
171
251
|
}
|
|
172
252
|
}
|
|
173
253
|
|
|
174
|
-
|
|
254
|
+
// Usage
|
|
255
|
+
const folder = await client.folders.create("Backup-" + Date.now());
|
|
256
|
+
await backupFolder("./my-documents", folder.folderKey);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Get all links from a folder
|
|
260
|
+
|
|
261
|
+
```javascript
|
|
262
|
+
const files = await client.folders.getFiles("folderKey");
|
|
263
|
+
|
|
264
|
+
for (const file of files) {
|
|
265
|
+
const links = await client.files.getLinks(file.quickKey);
|
|
266
|
+
console.log(`${file.name}: ${links.directDownload || links.viewLink}`);
|
|
267
|
+
}
|
|
175
268
|
```
|
|
176
269
|
|
|
177
|
-
|
|
270
|
+
### Search and download
|
|
178
271
|
|
|
179
|
-
|
|
272
|
+
```javascript
|
|
273
|
+
const results = await client.files.search("report");
|
|
180
274
|
|
|
181
|
-
|
|
275
|
+
for (const file of results.files) {
|
|
276
|
+
const links = await client.files.getLinks(file.quickKey);
|
|
277
|
+
console.log(`📄 ${file.name}`);
|
|
278
|
+
console.log(` Download: ${links.directDownload}`);
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## ⚠️ Error Handling
|
|
285
|
+
|
|
286
|
+
```javascript
|
|
287
|
+
const { MediaFireClient, MediaFireError } = require("@jesusacd/mediafire");
|
|
288
|
+
|
|
289
|
+
try {
|
|
290
|
+
await client.login("email", "wrong-password");
|
|
291
|
+
} catch (error) {
|
|
292
|
+
if (error instanceof MediaFireError) {
|
|
293
|
+
console.log("MediaFire Error:", error.message);
|
|
294
|
+
console.log("Code:", error.code);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## 📊 Limits and Performance
|
|
302
|
+
|
|
303
|
+
- **Max file size**: Depends on your MediaFire plan
|
|
304
|
+
- **Upload speed**: ~16 MB/s (depends on your connection)
|
|
305
|
+
- **Session**: Automatically managed with key rotation
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 🔧 Advanced Configuration
|
|
310
|
+
|
|
311
|
+
```javascript
|
|
312
|
+
const client = new MediaFireClient({
|
|
313
|
+
appId: "42511", // App ID (optional, uses default)
|
|
314
|
+
apiVersion: "1.3", // API version
|
|
315
|
+
timeout: 30000, // Timeout in ms
|
|
316
|
+
});
|
|
317
|
+
```
|
|
182
318
|
|
|
183
|
-
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 📋 Available Methods
|
|
322
|
+
|
|
323
|
+
| Module | Method | Description |
|
|
324
|
+
| ----------- | ------------------------------- | -------------------- |
|
|
325
|
+
| **Auth** | `login(email, password)` | Log in |
|
|
326
|
+
| | `logout()` | Log out |
|
|
327
|
+
| | `isAuthenticated()` | Check authentication |
|
|
328
|
+
| | `getSession()` | Get session data |
|
|
329
|
+
| | `setSession(session)` | Restore session |
|
|
330
|
+
| **User** | `getInfo()` | User info |
|
|
331
|
+
| | `getStorage()` | Storage used |
|
|
332
|
+
| **Folders** | `getContent(key, options)` | List contents |
|
|
333
|
+
| | `getFiles(key, options)` | List files |
|
|
334
|
+
| | `getFolders(key, options)` | List folders |
|
|
335
|
+
| | `getInfo(key)` | Folder info |
|
|
336
|
+
| | `create(name, parentKey)` | Create folder |
|
|
337
|
+
| | `rename(key, newName)` | Rename |
|
|
338
|
+
| | `move(key, destKey)` | Move |
|
|
339
|
+
| | `copy(key, destKey)` | Copy |
|
|
340
|
+
| | `setPrivacy(key, privacy)` | Change privacy |
|
|
341
|
+
| | `delete(key)` | Delete (trash) |
|
|
342
|
+
| | `purge(key)` | Permanently delete |
|
|
343
|
+
| **Files** | `getInfo(quickKey)` | File info |
|
|
344
|
+
| | `getLinks(quickKey)` | Get links |
|
|
345
|
+
| | `search(query, options)` | Search files |
|
|
346
|
+
| | `setPrivacy(quickKey, privacy)` | Change privacy |
|
|
347
|
+
| | `makePublic(quickKey)` | Make public |
|
|
348
|
+
| | `makePrivate(quickKey)` | Make private |
|
|
349
|
+
| | `rename(quickKey, newName)` | Rename |
|
|
350
|
+
| | `move(quickKey, folderKey)` | Move |
|
|
351
|
+
| | `copy(quickKey, folderKey)` | Copy |
|
|
352
|
+
| | `delete(quickKey)` | Delete (trash) |
|
|
353
|
+
| | `restore(quickKey)` | Restore |
|
|
354
|
+
| | `purge(quickKey)` | Permanently delete |
|
|
355
|
+
| | `getVersions(quickKey)` | Version history |
|
|
356
|
+
| | `getRecentlyModified()` | Recent files |
|
|
357
|
+
| **Upload** | `file(path, options)` | Upload from disk |
|
|
358
|
+
| | `buffer(buffer, name, options)` | Upload from buffer |
|
|
359
|
+
| | `check(hash, name, size)` | Check existence |
|
|
360
|
+
| | `instant(hash, name, size)` | Instant upload |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## 📄 License
|
|
365
|
+
|
|
366
|
+
MIT © JesusACD
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UserModule } from './modules/user';
|
|
2
2
|
import { FilesModule } from './modules/files';
|
|
3
3
|
import { FoldersModule } from './modules/folders';
|
|
4
|
+
import { UploadModule } from './modules/upload';
|
|
4
5
|
import { MediaFireConfig, SessionData } from './types';
|
|
5
6
|
/**
|
|
6
7
|
* MediaFire SDK Client
|
|
@@ -27,6 +28,7 @@ export declare class MediaFireClient {
|
|
|
27
28
|
private _user?;
|
|
28
29
|
private _files?;
|
|
29
30
|
private _folders?;
|
|
31
|
+
private _upload?;
|
|
30
32
|
/**
|
|
31
33
|
* Create a new MediaFire client
|
|
32
34
|
*
|
|
@@ -106,5 +108,15 @@ export declare class MediaFireClient {
|
|
|
106
108
|
* ```
|
|
107
109
|
*/
|
|
108
110
|
get folders(): FoldersModule;
|
|
111
|
+
/**
|
|
112
|
+
* Upload operations module
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const result = await client.upload.file('path/to/file.pdf');
|
|
117
|
+
* const buffer = await client.upload.buffer(data, 'filename.txt');
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
get upload(): UploadModule;
|
|
109
121
|
}
|
|
110
122
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAC;AAMvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,OAAO,CAAgC;IAG/C,OAAO,CAAC,KAAK,CAAC,CAAa;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAAC,CAAgB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAC;AAMvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,OAAO,CAAgC;IAG/C,OAAO,CAAC,KAAK,CAAC,CAAa;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,CAAC,OAAO,CAAC,CAAe;IAE/B;;;;OAIG;gBACS,MAAM,GAAE,eAAoB;IAQxC;;;;;;;;;;;;;OAaG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAoElE;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;;;OAIG;IACH,eAAe,IAAI,OAAO;IAI1B;;;;OAIG;IACH,UAAU,IAAI,WAAW,GAAG,IAAI;IAUhC;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAStC;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAExB;IAEF;;;;;;;;OAQG;IACH,IAAI,IAAI,IAAI,UAAU,CAKrB;IAED;;;;;;;;;OASG;IACH,IAAI,KAAK,IAAI,WAAW,CAKvB;IAED;;;;;;;;;OASG;IACH,IAAI,OAAO,IAAI,aAAa,CAK3B;IAED;;;;;;;;OAQG;IACH,IAAI,MAAM,IAAI,YAAY,CAKzB;CACF"}
|
package/dist/client.js
CHANGED
|
@@ -13,6 +13,7 @@ const utils_1 = require("./utils");
|
|
|
13
13
|
const user_1 = require("./modules/user");
|
|
14
14
|
const files_1 = require("./modules/files");
|
|
15
15
|
const folders_1 = require("./modules/folders");
|
|
16
|
+
const upload_1 = require("./modules/upload");
|
|
16
17
|
const types_1 = require("./types");
|
|
17
18
|
const API_BASE = 'https://www.mediafire.com/api';
|
|
18
19
|
const DEFAULT_APP_ID = '42511';
|
|
@@ -200,6 +201,21 @@ class MediaFireClient {
|
|
|
200
201
|
}
|
|
201
202
|
return this._folders;
|
|
202
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Upload operations module
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const result = await client.upload.file('path/to/file.pdf');
|
|
210
|
+
* const buffer = await client.upload.buffer(data, 'filename.txt');
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
get upload() {
|
|
214
|
+
if (!this._upload) {
|
|
215
|
+
this._upload = new upload_1.UploadModule(this.getInternalSession);
|
|
216
|
+
}
|
|
217
|
+
return this._upload;
|
|
218
|
+
}
|
|
203
219
|
}
|
|
204
220
|
exports.MediaFireClient = MediaFireClient;
|
|
205
221
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA;;GAEG;AACH,4DAA+B;AAC/B,iCAA2C;AAC3C,mCAAqC;AAErC,yCAA4C;AAC5C,2CAA8C;AAC9C,+CAAkD;AAClD,mCAAuE;AAEvE,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACjD,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA;;GAEG;AACH,4DAA+B;AAC/B,iCAA2C;AAC3C,mCAAqC;AAErC,yCAA4C;AAC5C,2CAA8C;AAC9C,+CAAkD;AAClD,6CAAgD;AAChD,mCAAuE;AAEvE,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACjD,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,eAAe;IAU1B;;;;OAIG;IACH,YAAY,SAA0B,EAAE;QAbhC,YAAO,GAA2B,IAAI,CAAC;QAoJ/C;;WAEG;QACK,uBAAkB,GAAG,GAA2B,EAAE;YACxD,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC,CAAC;QA3IA,IAAI,CAAC,MAAM,GAAG;YACZ,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,c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Y;YAClC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC;IACJ,CAAC;IASD;;;;;;;;OAQG;IACH,IAAI,IAAI;QACN,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,KAAK;QACP,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,OAAO;QACT,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,uBAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,OAAO,GAAG,IAAI,qBAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AA9ND,0CA8NC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export * from './types';
|
|
|
8
8
|
export { UserModule } from './modules/user';
|
|
9
9
|
export { FilesModule } from './modules/files';
|
|
10
10
|
export { FoldersModule, GetContentOptions } from './modules/folders';
|
|
11
|
+
export { UploadModule, UploadResult, UploadOptions } from './modules/upload';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.FoldersModule = exports.FilesModule = exports.UserModule = exports.MediaFireClient = void 0;
|
|
22
|
+
exports.UploadModule = exports.FoldersModule = exports.FilesModule = exports.UserModule = exports.MediaFireClient = void 0;
|
|
23
23
|
// Main client
|
|
24
24
|
var client_1 = require("./client");
|
|
25
25
|
Object.defineProperty(exports, "MediaFireClient", { enumerable: true, get: function () { return client_1.MediaFireClient; } });
|
|
@@ -32,4 +32,6 @@ var files_1 = require("./modules/files");
|
|
|
32
32
|
Object.defineProperty(exports, "FilesModule", { enumerable: true, get: function () { return files_1.FilesModule; } });
|
|
33
33
|
var folders_1 = require("./modules/folders");
|
|
34
34
|
Object.defineProperty(exports, "FoldersModule", { enumerable: true, get: function () { return folders_1.FoldersModule; } });
|
|
35
|
+
var upload_1 = require("./modules/upload");
|
|
36
|
+
Object.defineProperty(exports, "UploadModule", { enumerable: true, get: function () { return upload_1.UploadModule; } });
|
|
35
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,cAAc;AACd,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AAExB,QAAQ;AACR,0CAAwB;AAExB,+BAA+B;AAC/B,uCAA4C;AAAnC,kGAAA,UAAU,OAAA;AACnB,yCAA8C;AAArC,oGAAA,WAAW,OAAA;AACpB,6CAAqE;AAA5D,wGAAA,aAAa,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,cAAc;AACd,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AAExB,QAAQ;AACR,0CAAwB;AAExB,+BAA+B;AAC/B,uCAA4C;AAAnC,kGAAA,UAAU,OAAA;AACnB,yCAA8C;AAArC,oGAAA,WAAW,OAAA;AACpB,6CAAqE;AAA5D,wGAAA,aAAa,OAAA;AACtB,2CAA6E;AAApE,sGAAA,YAAY,OAAA"}
|