@jesusacd/mediafire 1.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folders.js","sourceRoot":"","sources":["../../src/modules/folders.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,gCAAkD;AAElD,oCAAuC;AAcvC;;GAEG;AACH,MAAa,aAAa;IACxB,YAAoB,UAAwC;QAAxC,eAAU,GAAV,UAAU,CAA8B;IAAG,CAAC;IAEhE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,UAAU,CAAC,YAAoB,SAAS,EAAE,UAA6B,EAAE;QAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAED,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;QAEpE,MAAM,OAAO,GAAiB,EAAE,CAAC;QACjC,MAAM,KAAK,GAAe,EAAE,CAAC;QAC7B,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,wBAAwB;QACxB,IAAI,WAAW,KAAK,KAAK,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAevD,MAAM,QAAQ,GAAG,MAAM,IAAA,aAAO,EAAiB,oBAAoB,EAAE;gBACnE,UAAU,EAAE,SAAS;gBACrB,YAAY,EAAE,SAAS;gBACvB,KAAK;gBACL,UAAU,EAAE,SAAS;aACtB,EAAE,OAAO,CAAC,CAAC;YAEZ,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,IAAI,EAAE,CAAC;YAEpD,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBAC7C,OAAO,CAAC,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AI,CAAC,OAAO;oBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,QAAQ,EAAE,KAAK;iBAChB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,WAAW,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;gBACtC,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;QACH,CAAC;QAED,kCAAkC;QAClC,MAAM,KAAK,GAAkB,CAAC,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC;QAEpD,OAAO;YACL,SAAS;YACT,KAAK;YACL,OAAO;YACP,KAAK;SACN,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CAAC,YAAoB,SAAS,EAAE,UAAkD,EAAE;QAChG,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;QACvF,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAoB,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,UAAU,CAAC,YAAoB,SAAS,EAAE,UAAkD,EAAE;QAClG,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;QACzF,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAsB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3E,CAAC;CACF;AA5JD,sCA4JC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * User Module - User and storage operations
3
+ */
4
+ import { InternalSession } from '../api';
5
+ import { UserInfo, StorageQuota } from '../types';
6
+ /**
7
+ * User module for user information and storage operations
8
+ */
9
+ export declare class UserModule {
10
+ private getSession;
11
+ constructor(getSession: () => InternalSession | null);
12
+ /**
13
+ * Get current user information
14
+ *
15
+ * @returns User info
16
+ * @throws MediaFireError if not authenticated or API error
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const user = await client.user.getInfo();
21
+ * console.log(`Hello, ${user.displayName}!`);
22
+ * ```
23
+ */
24
+ getInfo(): Promise<UserInfo>;
25
+ /**
26
+ * Get storage quota information
27
+ *
28
+ * @returns Storage quota info
29
+ * @throws MediaFireError if not authenticated or API error
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const storage = await client.user.getStorage();
34
+ * console.log(`Used: ${storage.usedFormatted} / ${storage.totalFormatted}`);
35
+ * console.log(`${storage.percentUsed}% used`);
36
+ * ```
37
+ */
38
+ getStorage(): Promise<StorageQuota>;
39
+ }
40
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/modules/user.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAW,eAAe,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGlD;;GAEG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,MAAM,eAAe,GAAG,IAAI;IAE5D;;;;;;;;;;;OAWG;IACG,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;IAgClC;;;;;;;;;;;;OAYG;IACG,UAAU,IAAI,OAAO,CAAC,YAAY,CAAC;CA8B1C"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserModule = void 0;
4
+ /**
5
+ * User Module - User and storage operations
6
+ */
7
+ const api_1 = require("../api");
8
+ const utils_1 = require("../utils");
9
+ /**
10
+ * User module for user information and storage operations
11
+ */
12
+ class UserModule {
13
+ constructor(getSession) {
14
+ this.getSession = getSession;
15
+ }
16
+ /**
17
+ * Get current user information
18
+ *
19
+ * @returns User info
20
+ * @throws MediaFireError if not authenticated or API error
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const user = await client.user.getInfo();
25
+ * console.log(`Hello, ${user.displayName}!`);
26
+ * ```
27
+ */
28
+ async getInfo() {
29
+ const session = this.getSession();
30
+ if (!session) {
31
+ throw new Error('Not authenticated. Please call login() first.');
32
+ }
33
+ const response = await (0, api_1.apiCall)('user/get_info', {}, session);
34
+ const info = response.user_info;
35
+ return {
36
+ email: info.email,
37
+ displayName: info.display_name || info.first_name || info.email?.split('@')[0] || '',
38
+ firstName: info.first_name,
39
+ lastName: info.last_name,
40
+ premium: info.premium === 'yes',
41
+ validated: info.validated === 'yes',
42
+ createdAt: info.created
43
+ };
44
+ }
45
+ /**
46
+ * Get storage quota information
47
+ *
48
+ * @returns Storage quota info
49
+ * @throws MediaFireError if not authenticated or API error
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const storage = await client.user.getStorage();
54
+ * console.log(`Used: ${storage.usedFormatted} / ${storage.totalFormatted}`);
55
+ * console.log(`${storage.percentUsed}% used`);
56
+ * ```
57
+ */
58
+ async getStorage() {
59
+ const session = this.getSession();
60
+ if (!session) {
61
+ throw new Error('Not authenticated. Please call login() first.');
62
+ }
63
+ const response = await (0, api_1.apiCall)('user/get_info', {}, session);
64
+ const info = response.user_info || {};
65
+ const usedBytes = parseInt(info.used_storage_size || info.storage_used || '0', 10);
66
+ // Free accounts get 10GB (10737418240 bytes)
67
+ const totalBytes = parseInt(info.storage_limit || info.storage_limit_free || '10737418240', 10);
68
+ return {
69
+ usedBytes,
70
+ totalBytes,
71
+ usedFormatted: (0, utils_1.formatBytes)(usedBytes),
72
+ totalFormatted: (0, utils_1.formatBytes)(totalBytes),
73
+ percentUsed: totalBytes > 0 ? parseFloat(((usedBytes / totalBytes) * 100).toFixed(1)) : 0
74
+ };
75
+ }
76
+ }
77
+ exports.UserModule = UserModule;
78
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/modules/user.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,gCAAkD;AAElD,oCAAuC;AAEvC;;GAEG;AACH,MAAa,UAAU;IACrB,YAAoB,UAAwC;QAAxC,eAAU,GAAV,UAAU,CAA8B;IAAG,CAAC;IAEhE;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAcD,MAAM,QAAQ,GAAG,MAAM,IAAA,aAAO,EAAmB,eAAe,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAC/E,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC;QAEhC,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YACpF,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,OAAO,EAAE,IAAI,CAAC,OAAO,KAAK,KAAK;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,KAAK;YACnC,SAAS,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAWD,MAAM,QAAQ,GAAG,MAAM,IAAA,aAAO,EAAkB,eAAe,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9E,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC;QAEtC,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;QACnF,6CAA6C;QAC7C,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,kBAAkB,IAAI,aAAa,EAAE,EAAE,CAAC,CAAC;QAEhG,OAAO;YACL,SAAS;YACT,UAAU;YACV,aAAa,EAAE,IAAA,mBAAW,EAAC,SAAS,CAAC;YACrC,cAAc,EAAE,IAAA,mBAAW,EAAC,UAAU,CAAC;YACvC,WAAW,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1F,CAAC;IACJ,CAAC;CACF;AA1FD,gCA0FC"}
@@ -0,0 +1,226 @@
1
+ /**
2
+ * MediaFire SDK Types
3
+ * @packageDocumentation
4
+ */
5
+ /**
6
+ * Configuration options for MediaFireClient
7
+ */
8
+ export interface MediaFireConfig {
9
+ /**
10
+ * MediaFire Application ID (default: 42511)
11
+ */
12
+ appId?: string;
13
+ /**
14
+ * API version to use (default: 1.3)
15
+ */
16
+ apiVersion?: string;
17
+ /**
18
+ * Request timeout in milliseconds (default: 30000)
19
+ */
20
+ timeout?: number;
21
+ }
22
+ /**
23
+ * Session data returned after successful login
24
+ */
25
+ export interface SessionData {
26
+ /** Session token for API calls */
27
+ sessionToken: string;
28
+ /** Secret key for request signing */
29
+ secretKey: string;
30
+ /** Server time at login */
31
+ time: string;
32
+ /** User email */
33
+ email: string;
34
+ }
35
+ /**
36
+ * Credentials for login
37
+ */
38
+ export interface Credentials {
39
+ email: string;
40
+ password: string;
41
+ }
42
+ /**
43
+ * User information
44
+ */
45
+ export interface UserInfo {
46
+ /** User email */
47
+ email: string;
48
+ /** Display name */
49
+ displayName: string;
50
+ /** First name */
51
+ firstName?: string;
52
+ /** Last name */
53
+ lastName?: string;
54
+ /** Is premium user */
55
+ premium: boolean;
56
+ /** Is email validated */
57
+ validated: boolean;
58
+ /** Account creation date */
59
+ createdAt?: string;
60
+ }
61
+ /**
62
+ * Storage quota information
63
+ */
64
+ export interface StorageQuota {
65
+ /** Used storage in bytes */
66
+ usedBytes: number;
67
+ /** Total storage limit in bytes */
68
+ totalBytes: number;
69
+ /** Human-readable used storage */
70
+ usedFormatted: string;
71
+ /** Human-readable total storage */
72
+ totalFormatted: string;
73
+ /** Percentage of storage used */
74
+ percentUsed: number;
75
+ }
76
+ /**
77
+ * File information
78
+ */
79
+ export interface FileInfo {
80
+ /** Quick key (file identifier) */
81
+ quickKey: string;
82
+ /** File name */
83
+ name: string;
84
+ /** File size in bytes */
85
+ size: number;
86
+ /** Human-readable file size */
87
+ sizeFormatted: string;
88
+ /** Creation date */
89
+ created?: string;
90
+ /** MIME type */
91
+ mimeType?: string;
92
+ /** Number of downloads */
93
+ downloads?: number;
94
+ /** Privacy setting */
95
+ privacy?: string;
96
+ /** Is password protected */
97
+ passwordProtected?: boolean;
98
+ }
99
+ /**
100
+ * Download links for a file
101
+ */
102
+ export interface DownloadLinks {
103
+ /** Direct download URL */
104
+ directDownload?: string;
105
+ /** Normal download URL (through MediaFire page) */
106
+ normalDownload?: string;
107
+ /** View/share link */
108
+ viewLink: string;
109
+ }
110
+ /**
111
+ * File item in folder listing
112
+ */
113
+ export interface FileItem {
114
+ /** Quick key */
115
+ id: string;
116
+ /** Quick key (alias) */
117
+ quickKey: string;
118
+ /** File name */
119
+ name: string;
120
+ /** File size in bytes */
121
+ size: number;
122
+ /** Human-readable size */
123
+ sizeFormatted: string;
124
+ /** Creation date */
125
+ created?: string;
126
+ /** MIME type */
127
+ mimeType?: string;
128
+ /** Privacy setting */
129
+ privacy?: string;
130
+ /** Parent folder key */
131
+ parentFolderKey?: string;
132
+ /** Parent folder name */
133
+ parentName?: string;
134
+ /** Always false for files */
135
+ isFolder: false;
136
+ }
137
+ /**
138
+ * Folder information
139
+ */
140
+ export interface FolderInfo {
141
+ /** Folder key (identifier) */
142
+ folderKey: string;
143
+ /** Folder name */
144
+ name: string;
145
+ /** Number of files in folder */
146
+ fileCount: number;
147
+ /** Number of subfolders */
148
+ folderCount: number;
149
+ /** Creation date */
150
+ created?: string;
151
+ }
152
+ /**
153
+ * Folder item in folder listing
154
+ */
155
+ export interface FolderItem {
156
+ /** Folder key */
157
+ id: string;
158
+ /** Folder key (alias) */
159
+ folderKey: string;
160
+ /** Folder name */
161
+ name: string;
162
+ /** Creation date */
163
+ created?: string;
164
+ /** Number of files */
165
+ fileCount: number;
166
+ /** Number of subfolders */
167
+ folderCount: number;
168
+ /** Parent folder key */
169
+ parentFolderKey?: string;
170
+ /** Parent folder name */
171
+ parentName?: string;
172
+ /** Always true for folders */
173
+ isFolder: true;
174
+ }
175
+ /**
176
+ * Content item (file or folder)
177
+ */
178
+ export type ContentItem = FileItem | FolderItem;
179
+ /**
180
+ * Folder content response
181
+ */
182
+ export interface FolderContent {
183
+ /** Folder key */
184
+ folderKey: string;
185
+ /** List of items (files and folders) */
186
+ items: ContentItem[];
187
+ /** Whether there are more items */
188
+ hasMore: boolean;
189
+ /** Current chunk number */
190
+ chunk: number;
191
+ }
192
+ /**
193
+ * Search results
194
+ */
195
+ export interface SearchResults {
196
+ /** Search query */
197
+ query: string;
198
+ /** Found items */
199
+ items: ContentItem[];
200
+ /** Total number of results */
201
+ total: number;
202
+ }
203
+ /**
204
+ * Base API response structure
205
+ */
206
+ export interface ApiResponse<T = unknown> {
207
+ /** Whether the request was successful */
208
+ success: boolean;
209
+ /** Response data */
210
+ data?: T;
211
+ /** Error message if failed */
212
+ error?: string;
213
+ /** Error code if failed */
214
+ code?: number;
215
+ }
216
+ /**
217
+ * MediaFire API error
218
+ */
219
+ export declare class MediaFireError extends Error {
220
+ /** Error code from API */
221
+ code?: number;
222
+ /** Original response */
223
+ response?: unknown;
224
+ constructor(message: string, code?: number, response?: unknown);
225
+ }
226
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,yBAAyB;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAA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O,EAAE,OAAO,CAAC;IACjB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAEP,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO;CAM/D"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * MediaFire SDK Types
4
+ * @packageDocumentation
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MediaFireError = void 0;
8
+ /**
9
+ * MediaFire API error
10
+ */
11
+ class MediaFireError extends Error {
12
+ constructor(message, code, response) {
13
+ super(message);
14
+ this.name = 'MediaFireError';
15
+ this.code = code;
16
+ this.response = response;
17
+ }
18
+ }
19
+ exports.MediaFireError = MediaFireError;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiPH;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAMvC,YAAY,OAAe,EAAE,IAAa,EAAE,QAAkB;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAZD,wCAYC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Utility functions for MediaFire SDK
3
+ */
4
+ /**
5
+ * Format bytes to human-readable string
6
+ *
7
+ * @param bytes - Number of bytes
8
+ * @returns Formatted string (e.g., "1.5 GB")
9
+ */
10
+ export declare function formatBytes(bytes: number): string;
11
+ /**
12
+ * Sort URLSearchParams alphabetically
13
+ *
14
+ * @param params - URLSearchParams to sort
15
+ * @returns New sorted URLSearchParams
16
+ */
17
+ export declare function sortParams(params: URLSearchParams): URLSearchParams;
18
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAGnE"}
package/dist/utils.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Utility functions for MediaFire SDK
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatBytes = formatBytes;
7
+ exports.sortParams = sortParams;
8
+ /**
9
+ * Format bytes to human-readable string
10
+ *
11
+ * @param bytes - Number of bytes
12
+ * @returns Formatted string (e.g., "1.5 GB")
13
+ */
14
+ function formatBytes(bytes) {
15
+ if (bytes === 0)
16
+ return '0 Bytes';
17
+ const k = 1024;
18
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
19
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
20
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
21
+ }
22
+ /**
23
+ * Sort URLSearchParams alphabetically
24
+ *
25
+ * @param params - URLSearchParams to sort
26
+ * @returns New sorted URLSearchParams
27
+ */
28
+ function sortParams(params) {
29
+ const entries = [...params.entries()].sort((a, b) => a[0].localeCompare(b[0]));
30
+ return new URLSearchParams(entries);
31
+ }
32
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,kCAQC;AAQD,gCAGC;AAzBD;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAa;IACvC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAElC,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,OAAO,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,MAAuB;IAChD,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@jesusacd/mediafire",
3
+ "version": "1.0.0",
4
+ "description": "MediaFire API SDK for Node.js - Upload, download, and manage files on MediaFire",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "clean": "rimraf dist",
21
+ "typecheck": "tsc --noEmit",
22
+ "prepublishOnly": "npm run clean && npm run build",
23
+ "publish:public": "npm publish --access public",
24
+ "release:patch": "npm version patch && npm run publish:public",
25
+ "release:minor": "npm version minor && npm run publish:public",
26
+ "release:major": "npm version major && npm run publish:public"
27
+ },
28
+ "keywords": [
29
+ "mediafire",
30
+ "cloud-storage",
31
+ "file-upload",
32
+ "file-download",
33
+ "nodejs",
34
+ "api",
35
+ "sdk"
36
+ ],
37
+ "author": "JesusACD",
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/JesusACD/mediafire"
42
+ },
43
+ "engines": {
44
+ "node": ">=16.0.0"
45
+ },
46
+ "dependencies": {
47
+ "node-fetch": "^2.7.0"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "^20.10.0",
51
+ "@types/node-fetch": "^2.6.9",
52
+ "rimraf": "^5.0.5",
53
+ "typescript": "^5.3.0"
54
+ }
55
+ }