@muhgholy/next-drive 3.4.0 → 3.6.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 CHANGED
@@ -321,6 +321,40 @@ const drive = await Drive.findById(fileId);
321
321
  const { stream, mime, size } = await driveReadFile(drive);
322
322
  ```
323
323
 
324
+ ### Get File/Folder Information
325
+
326
+ ```typescript
327
+ import { driveInfo } from "@muhgholy/next-drive/server";
328
+
329
+ // Using file ID
330
+ const info = await driveInfo("694f5013226de007be94fcc0");
331
+ console.log(info.name, info.size, info.createdAt);
332
+ console.log(info.dimensions); // { width: 1920, height: 1080 } for images
333
+ console.log(info.duration); // 120 (seconds) for videos
334
+
335
+ // Using TDriveFile
336
+ const file = { id: "123", file: { name: "photo.jpg", mime: "image/jpeg", size: 1024 } };
337
+ const info = await driveInfo(file);
338
+ ```
339
+
340
+ **Returns `TDriveInformation`:**
341
+
342
+ | Property | Type | Description |
343
+ | ------------ | -------------------- | ------------------------------------ |
344
+ | `id` | `string` | File/folder ID |
345
+ | `name` | `string` | File/folder name |
346
+ | `type` | `'FILE' \| 'FOLDER'` | Item type |
347
+ | `mime` | `string?` | MIME type (files only) |
348
+ | `size` | `number?` | Size in bytes (files only) |
349
+ | `hash` | `string?` | Content hash (files only) |
350
+ | `dimensions` | `{width, height}?` | Image dimensions |
351
+ | `duration` | `number?` | Video duration in seconds |
352
+ | `status` | `string` | Processing status |
353
+ | `provider` | `object` | Storage provider info (LOCAL/GOOGLE) |
354
+ | `parent` | `{id, name}?` | Parent folder |
355
+ | `createdAt` | `Date` | Creation timestamp |
356
+ | `trashedAt` | `Date \| null?` | Trash timestamp if deleted |
357
+
324
358
  ### Get Local File Path
325
359
 
326
360
  For libraries requiring file paths (Sharp, FFmpeg, etc.):
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // src/schemas.ts
6
+ var driveFileSchemaZod = zod.z.object({
7
+ id: zod.z.string(),
8
+ file: zod.z.object({
9
+ name: zod.z.string(),
10
+ mime: zod.z.string(),
11
+ size: zod.z.number()
12
+ })
13
+ });
14
+
15
+ exports.driveFileSchemaZod = driveFileSchemaZod;
16
+ //# sourceMappingURL=chunk-A65ZAA2Z.cjs.map
17
+ //# sourceMappingURL=chunk-A65ZAA2Z.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas.ts"],"names":["z"],"mappings":";;;;;AAIO,IAAM,kBAAA,GAAqBA,MAAE,MAAA,CAAO;AAAA,EACvC,EAAA,EAAIA,MAAE,MAAA,EAAO;AAAA,EACb,IAAA,EAAMA,MAAE,MAAA,CAAO;AAAA,IACX,IAAA,EAAMA,MAAE,MAAA,EAAO;AAAA,IACf,IAAA,EAAMA,MAAE,MAAA,EAAO;AAAA,IACf,IAAA,EAAMA,MAAE,MAAA;AAAO,GAClB;AACL,CAAC","file":"chunk-A65ZAA2Z.cjs","sourcesContent":["// ** Universal Schema Exports (can be used in both client and server)\nimport { z } from 'zod';\n\n// ** Drive File Schema (for validation)\nexport const driveFileSchemaZod = z.object({\n id: z.string(),\n file: z.object({\n name: z.string(),\n mime: z.string(),\n size: z.number(),\n }),\n});\n\n// ** Drive File Type\nexport type TDriveFile = z.infer<typeof driveFileSchemaZod>;\n"]}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+
10
+ exports.__require = __require;
11
+ //# sourceMappingURL=chunk-JEQ2X3Z6.cjs.map
12
+ //# sourceMappingURL=chunk-JEQ2X3Z6.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-JEQ2X3Z6.cjs"}