@jesusacd/mediafire 1.1.0 → 1.3.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 +325 -122
- 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 +151 -0
- package/dist/modules/files.d.ts.map +1 -1
- package/dist/modules/files.js +407 -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,386 @@
|
|
|
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
|
+
- 🔍 **Smart Search** - Advanced search with automatic keyword extraction
|
|
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
|
-
|
|
29
|
+
async function main() {
|
|
30
|
+
// Just email and password - that's it!
|
|
31
|
+
await client.login("your-email@example.com", "your-password");
|
|
32
|
+
|
|
33
|
+
// Get user info
|
|
34
|
+
const user = await client.user.getInfo();
|
|
35
|
+
console.log(`Hello, ${user.displayName}!`);
|
|
36
|
+
|
|
37
|
+
// Upload a file
|
|
38
|
+
const result = await client.upload.file("./my-file.pdf");
|
|
39
|
+
console.log(`Uploaded: ${result.quickKey}`);
|
|
40
|
+
|
|
41
|
+
// Get download link
|
|
42
|
+
const links = await client.files.getLinks(result.quickKey);
|
|
43
|
+
console.log(`Link: ${links.directDownload}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
main();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 📚 API Reference
|
|
50
|
+
|
|
51
|
+
### Authentication
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
const client = new MediaFireClient();
|
|
55
|
+
|
|
56
|
+
// Login with email and password
|
|
19
57
|
await client.login("email@example.com", "password");
|
|
20
58
|
|
|
21
|
-
//
|
|
59
|
+
// Check if authenticated
|
|
60
|
+
client.isAuthenticated(); // true
|
|
61
|
+
|
|
62
|
+
// Get session data
|
|
63
|
+
const session = client.getSession();
|
|
64
|
+
|
|
65
|
+
// Restore previous session
|
|
66
|
+
client.setSession(session);
|
|
67
|
+
|
|
68
|
+
// Logout
|
|
69
|
+
client.logout();
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 👤 User Module
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
// User information
|
|
22
78
|
const user = await client.user.getInfo();
|
|
23
|
-
|
|
79
|
+
// { displayName, email, firstName, lastName, gender, birthDate, premium, emailVerified, createdAt }
|
|
24
80
|
|
|
25
|
-
//
|
|
81
|
+
// Storage info
|
|
26
82
|
const storage = await client.user.getStorage();
|
|
27
|
-
|
|
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");
|
|
126
|
+
```
|
|
127
|
+
|
|
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 }
|
|
28
140
|
|
|
29
|
-
//
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
141
|
+
// Search files (basic)
|
|
142
|
+
const results = await client.files.search("document");
|
|
143
|
+
// { items: [...], total }
|
|
144
|
+
|
|
145
|
+
// Smart search (recommended for complex names)
|
|
146
|
+
const results = await client.files.smartSearch(
|
|
147
|
+
"La empresa de sillas (2025) Temporada 1 [1080p] {MAX} WEB-DL",
|
|
148
|
+
);
|
|
149
|
+
// Automatically extracts unique keywords and filters results
|
|
150
|
+
|
|
151
|
+
// Smart search with filters
|
|
152
|
+
const folders = await client.files.smartSearch("My Series", {
|
|
153
|
+
filter: "folders", // 'files' | 'folders' | 'everything'
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// Exact match
|
|
157
|
+
const exact = await client.files.smartSearch("exact name", {
|
|
158
|
+
exactMatch: true,
|
|
33
159
|
});
|
|
160
|
+
|
|
161
|
+
// Change privacy
|
|
162
|
+
await client.files.setPrivacy("quickKey", "public");
|
|
163
|
+
await client.files.makePublic("quickKey"); // Shortcut
|
|
164
|
+
await client.files.makePrivate("quickKey"); // Shortcut
|
|
165
|
+
|
|
166
|
+
// Rename file
|
|
167
|
+
await client.files.rename("quickKey", "new-name.pdf");
|
|
168
|
+
|
|
169
|
+
// Move to another folder
|
|
170
|
+
await client.files.move("quickKey", "folderKey");
|
|
171
|
+
|
|
172
|
+
// Copy file
|
|
173
|
+
const newKeys = await client.files.copy("quickKey", "folderKey");
|
|
174
|
+
|
|
175
|
+
// Delete (move to trash)
|
|
176
|
+
await client.files.delete("quickKey");
|
|
177
|
+
|
|
178
|
+
// Restore from trash
|
|
179
|
+
await client.files.restore("quickKey");
|
|
180
|
+
|
|
181
|
+
// Permanently delete
|
|
182
|
+
await client.files.purge("quickKey");
|
|
183
|
+
|
|
184
|
+
// Get file versions
|
|
185
|
+
const versions = await client.files.getVersions("quickKey");
|
|
186
|
+
|
|
187
|
+
// Get recently modified files
|
|
188
|
+
const recent = await client.files.getRecentlyModified();
|
|
34
189
|
```
|
|
35
190
|
|
|
36
|
-
|
|
191
|
+
---
|
|
37
192
|
|
|
38
|
-
###
|
|
193
|
+
### 📤 Upload Module
|
|
39
194
|
|
|
40
|
-
```
|
|
41
|
-
|
|
195
|
+
```javascript
|
|
196
|
+
// Upload file from disk
|
|
197
|
+
const result = await client.upload.file("./file.pdf", {
|
|
198
|
+
folderKey: "destFolderKey", // Optional: destination folder
|
|
199
|
+
actionOnDuplicate: "keep", // 'skip' | 'keep' | 'replace'
|
|
200
|
+
});
|
|
201
|
+
// { quickKey, filename, size, uploadKey }
|
|
202
|
+
|
|
203
|
+
// Upload from Buffer
|
|
204
|
+
const buffer = Buffer.from("File content");
|
|
205
|
+
const result = await client.upload.buffer(buffer, "file.txt", {
|
|
206
|
+
folderKey: "destFolderKey",
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Check if file exists (for instant upload)
|
|
210
|
+
const check = await client.upload.check(sha256Hash, "file.pdf", fileSize);
|
|
211
|
+
// { hashExists, inAccount, inFolder, duplicateQuickKey }
|
|
212
|
+
|
|
213
|
+
// Instant upload (if file already exists on MediaFire)
|
|
214
|
+
const result = await client.upload.instant(
|
|
215
|
+
sha256Hash,
|
|
216
|
+
"file.pdf",
|
|
217
|
+
fileSize,
|
|
218
|
+
"folderKey",
|
|
219
|
+
);
|
|
42
220
|
```
|
|
43
221
|
|
|
44
|
-
|
|
222
|
+
---
|
|
45
223
|
|
|
46
|
-
|
|
47
|
-
// Login
|
|
48
|
-
const session = await client.login(email, password);
|
|
224
|
+
## 💡 Usage Examples
|
|
49
225
|
|
|
50
|
-
|
|
51
|
-
client.isAuthenticated(); // boolean
|
|
226
|
+
### Upload multiple files
|
|
52
227
|
|
|
53
|
-
|
|
54
|
-
|
|
228
|
+
```javascript
|
|
229
|
+
const files = ["doc1.pdf", "doc2.pdf", "image.png"];
|
|
55
230
|
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
231
|
+
for (const file of files) {
|
|
232
|
+
const result = await client.upload.file(file);
|
|
233
|
+
console.log(`✅ ${file} -> ${result.quickKey}`);
|
|
234
|
+
}
|
|
59
235
|
```
|
|
60
236
|
|
|
61
|
-
###
|
|
237
|
+
### Create folder structure
|
|
62
238
|
|
|
63
|
-
```
|
|
64
|
-
//
|
|
65
|
-
const
|
|
66
|
-
// { email, displayName, firstName, lastName, premium, validated, createdAt }
|
|
239
|
+
```javascript
|
|
240
|
+
// Create main folder
|
|
241
|
+
const main = await client.folders.create("Project 2024");
|
|
67
242
|
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
243
|
+
// Create subfolders
|
|
244
|
+
await client.folders.create("Documents", main.folderKey);
|
|
245
|
+
await client.folders.create("Images", main.folderKey);
|
|
246
|
+
await client.folders.create("Videos", main.folderKey);
|
|
71
247
|
```
|
|
72
248
|
|
|
73
|
-
###
|
|
249
|
+
### Backup local folder
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
const fs = require("fs");
|
|
253
|
+
const path = require("path");
|
|
254
|
+
|
|
255
|
+
async function backupFolder(localPath, remoteFolderKey) {
|
|
256
|
+
const files = fs.readdirSync(localPath);
|
|
74
257
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const file = await client.files.getInfo("quickkey");
|
|
78
|
-
// { quickKey, name, size, sizeFormatted, mimeType, downloads, privacy }
|
|
258
|
+
for (const file of files) {
|
|
259
|
+
const filePath = path.join(localPath, file);
|
|
79
260
|
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
261
|
+
if (fs.statSync(filePath).isFile()) {
|
|
262
|
+
const result = await client.upload.file(filePath, {
|
|
263
|
+
folderKey: remoteFolderKey,
|
|
264
|
+
});
|
|
265
|
+
console.log(`✅ ${file} uploaded`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
83
269
|
|
|
84
|
-
//
|
|
85
|
-
const
|
|
86
|
-
|
|
270
|
+
// Usage
|
|
271
|
+
const folder = await client.folders.create("Backup-" + Date.now());
|
|
272
|
+
await backupFolder("./my-documents", folder.folderKey);
|
|
87
273
|
```
|
|
88
274
|
|
|
89
|
-
###
|
|
275
|
+
### Get all links from a folder
|
|
90
276
|
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
277
|
+
```javascript
|
|
278
|
+
const files = await client.folders.getFiles("folderKey");
|
|
279
|
+
|
|
280
|
+
for (const file of files) {
|
|
281
|
+
const links = await client.files.getLinks(file.quickKey);
|
|
282
|
+
console.log(`${file.name}: ${links.directDownload || links.viewLink}`);
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Search and download
|
|
101
287
|
|
|
102
|
-
|
|
103
|
-
|
|
288
|
+
```javascript
|
|
289
|
+
// Use smartSearch for complex file names
|
|
290
|
+
const results = await client.files.smartSearch(
|
|
291
|
+
"Prison Break (2005-2017) Temporada 1-5 [Full 1080p]",
|
|
292
|
+
);
|
|
104
293
|
|
|
105
|
-
|
|
106
|
-
const
|
|
294
|
+
for (const file of results.items.filter((i) => !i.isFolder)) {
|
|
295
|
+
const links = await client.files.getLinks(file.quickKey);
|
|
296
|
+
console.log(`📄 ${file.name}`);
|
|
297
|
+
console.log(` Download: ${links.directDownload}`);
|
|
298
|
+
}
|
|
107
299
|
```
|
|
108
300
|
|
|
109
|
-
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## ⚠️ Error Handling
|
|
110
304
|
|
|
111
|
-
```
|
|
112
|
-
|
|
305
|
+
```javascript
|
|
306
|
+
const { MediaFireClient, MediaFireError } = require("@jesusacd/mediafire");
|
|
113
307
|
|
|
114
308
|
try {
|
|
115
309
|
await client.login("email", "wrong-password");
|
|
116
310
|
} catch (error) {
|
|
117
311
|
if (error instanceof MediaFireError) {
|
|
118
|
-
console.log(
|
|
119
|
-
console.log(
|
|
312
|
+
console.log("MediaFire Error:", error.message);
|
|
313
|
+
console.log("Code:", error.code);
|
|
120
314
|
}
|
|
121
315
|
}
|
|
122
316
|
```
|
|
123
317
|
|
|
124
|
-
|
|
318
|
+
---
|
|
125
319
|
|
|
126
|
-
|
|
127
|
-
import { MediaFireClient, MediaFireError } from "@JesusACD/mediafire";
|
|
320
|
+
## 📊 Limits and Performance
|
|
128
321
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
try {
|
|
133
|
-
// Login
|
|
134
|
-
console.log("Iniciando sesión...");
|
|
135
|
-
await client.login(process.env.MF_EMAIL!, process.env.MF_PASSWORD!);
|
|
136
|
-
console.log("✅ Sesión iniciada");
|
|
137
|
-
|
|
138
|
-
// Usuario
|
|
139
|
-
const user = await client.user.getInfo();
|
|
140
|
-
console.log(`\n👤 Usuario: ${user.displayName}`);
|
|
141
|
-
console.log(` Email: ${user.email}`);
|
|
142
|
-
console.log(` Premium: ${user.premium ? "Sí" : "No"}`);
|
|
143
|
-
|
|
144
|
-
// Storage
|
|
145
|
-
const storage = await client.user.getStorage();
|
|
146
|
-
console.log(`\n💾 Almacenamiento:`);
|
|
147
|
-
console.log(
|
|
148
|
-
` Usado: ${storage.usedFormatted} / ${storage.totalFormatted}`,
|
|
149
|
-
);
|
|
150
|
-
console.log(` ${storage.percentUsed}% usado`);
|
|
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;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
322
|
+
- **Max file size**: Depends on your MediaFire plan
|
|
323
|
+
- **Upload speed**: ~16 MB/s (depends on your connection)
|
|
324
|
+
- **Session**: Automatically managed with key rotation
|
|
173
325
|
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Requisitos
|
|
326
|
+
---
|
|
178
327
|
|
|
179
|
-
|
|
328
|
+
## 🔧 Advanced Configuration
|
|
180
329
|
|
|
181
|
-
|
|
330
|
+
```javascript
|
|
331
|
+
const client = new MediaFireClient({
|
|
332
|
+
appId: "42511", // App ID (optional, uses default)
|
|
333
|
+
apiVersion: "1.3", // API version
|
|
334
|
+
timeout: 30000, // Timeout in ms
|
|
335
|
+
});
|
|
336
|
+
```
|
|
182
337
|
|
|
183
|
-
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## 📋 Available Methods
|
|
341
|
+
|
|
342
|
+
| Module | Method | Description |
|
|
343
|
+
| ----------- | ------------------------------- | -------------------------- |
|
|
344
|
+
| **Auth** | `login(email, password)` | Log in |
|
|
345
|
+
| | `logout()` | Log out |
|
|
346
|
+
| | `isAuthenticated()` | Check authentication |
|
|
347
|
+
| | `getSession()` | Get session data |
|
|
348
|
+
| | `setSession(session)` | Restore session |
|
|
349
|
+
| **User** | `getInfo()` | User info |
|
|
350
|
+
| | `getStorage()` | Storage used |
|
|
351
|
+
| **Folders** | `getContent(key, options)` | List contents |
|
|
352
|
+
| | `getFiles(key, options)` | List files |
|
|
353
|
+
| | `getFolders(key, options)` | List folders |
|
|
354
|
+
| | `getInfo(key)` | Folder info |
|
|
355
|
+
| | `create(name, parentKey)` | Create folder |
|
|
356
|
+
| | `rename(key, newName)` | Rename |
|
|
357
|
+
| | `move(key, destKey)` | Move |
|
|
358
|
+
| | `copy(key, destKey)` | Copy |
|
|
359
|
+
| | `setPrivacy(key, privacy)` | Change privacy |
|
|
360
|
+
| | `delete(key)` | Delete (trash) |
|
|
361
|
+
| | `purge(key)` | Permanently delete |
|
|
362
|
+
| **Files** | `getInfo(quickKey)` | File info |
|
|
363
|
+
| | `getLinks(quickKey)` | Get links |
|
|
364
|
+
| | `search(query)` | Basic search |
|
|
365
|
+
| | `smartSearch(query, options)` | Smart search (recommended) |
|
|
366
|
+
| | `setPrivacy(quickKey, privacy)` | Change privacy |
|
|
367
|
+
| | `makePublic(quickKey)` | Make public |
|
|
368
|
+
| | `makePrivate(quickKey)` | Make private |
|
|
369
|
+
| | `rename(quickKey, newName)` | Rename |
|
|
370
|
+
| | `move(quickKey, folderKey)` | Move |
|
|
371
|
+
| | `copy(quickKey, folderKey)` | Copy |
|
|
372
|
+
| | `delete(quickKey)` | Delete (trash) |
|
|
373
|
+
| | `restore(quickKey)` | Restore |
|
|
374
|
+
| | `purge(quickKey)` | Permanently delete |
|
|
375
|
+
| | `getVersions(quickKey)` | Version history |
|
|
376
|
+
| | `getRecentlyModified()` | Recent files |
|
|
377
|
+
| **Upload** | `file(path, options)` | Upload from disk |
|
|
378
|
+
| | `buffer(buffer, name, options)` | Upload from buffer |
|
|
379
|
+
| | `check(hash, name, size)` | Check existence |
|
|
380
|
+
| | `instant(hash, name, size)` | Instant upload |
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## 📄 License
|
|
385
|
+
|
|
386
|
+
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,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,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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G;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"}
|