@file-cabinet/web 0.0.1 → 0.0.2

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/dist/convert.d.ts CHANGED
@@ -22,16 +22,6 @@ export declare function base64ToBytes(data: string): Uint8Array;
22
22
  * @returns File object.
23
23
  **/
24
24
  export declare function base64ToFile(data: string, fileName?: string): Promise<File>;
25
- /**
26
- * Converts a buffer into a File object using MIME type detection.
27
- * Infers file extension from binary content.
28
- *
29
- * @param buff - The data to convert.
30
- * @param fileName - Name for the file (default = 'file')
31
- * @returns File object.
32
- * @throws If MIME type can't be determined.
33
- **/
34
- export declare function bufferToFile(buff: ArrayBuffer, fileName?: string): Promise<File>;
35
25
  /**
36
26
  * Converts a File object to a base64 data URL.
37
27
  *
package/dist/convert.js CHANGED
@@ -1,4 +1,3 @@
1
- import { fileTypeFromBuffer } from "file-type";
2
1
  /**
3
2
  * Converts bytes into a raw base64 string.
4
3
  * Doesn't include a data URL prefix.
@@ -52,24 +51,6 @@ export async function base64ToFile(data, fileName = "file") {
52
51
  lastModified: Date.now()
53
52
  });
54
53
  }
55
- /**
56
- * Converts a buffer into a File object using MIME type detection.
57
- * Infers file extension from binary content.
58
- *
59
- * @param buff - The data to convert.
60
- * @param fileName - Name for the file (default = 'file')
61
- * @returns File object.
62
- * @throws If MIME type can't be determined.
63
- **/
64
- export async function bufferToFile(buff, fileName = "file") {
65
- const type = await fileTypeFromBuffer(buff);
66
- if (!type)
67
- throw new Error("Couldn't get file type from buffer.");
68
- return new File([buff], `${fileName}.${type.ext}`, {
69
- type: type.mime,
70
- lastModified: Date.now()
71
- });
72
- }
73
54
  /**
74
55
  * Converts a File object to a base64 data URL.
75
56
  *
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  "name": "@file-cabinet/web",
4
4
 
5
- "version": "0.0.1",
5
+ "version": "0.0.2",
6
6
 
7
7
  "main": "./dist/index.js",
8
8
 
@@ -40,8 +40,6 @@
40
40
 
41
41
  "clsx": "^2.1.1",
42
42
 
43
- "file-type": "^22.0.1",
44
-
45
43
  "tailwind-merge": "^3.6.0"
46
44
 
47
45
  },