@e-mc/compress 0.8.2 → 0.8.4

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.
Files changed (2) hide show
  1. package/README.md +56 -3
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,7 +1,60 @@
1
- ### @e-mc/compress
1
+ # @e-mc/compress
2
2
 
3
- https://e-mc.readthedocs.io
3
+ * NodeJS 14
4
+ * ES2020
4
5
 
5
- ### LICENSE
6
+ ## General Usage
7
+
8
+ * [Read the Docs](https://e-mc.readthedocs.io)
9
+
10
+ ## Interface
11
+
12
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/index.d.ts
13
+
14
+ ```typescript
15
+ import type { CompressLevel } from "./squared";
16
+
17
+ import type { IModule, ModuleConstructor } from "./index";
18
+ import type { BufferResult, CompressFormat, TryFileCompressor, TryFileResult, TryImageResult } from "./compress";
19
+ import type { CompressModule, CompressSettings } from "./settings";
20
+
21
+ import type { WriteStream } from 'fs';
22
+ import type { Readable } from "stream";
23
+ import type { BrotliCompress, Gzip } from "zlib";
24
+
25
+ interface ICompress extends IModule {
26
+ module: CompressModule;
27
+ level: Record<string, number>;
28
+ compressors: Record<string, TryFileCompressor>;
29
+ chunkSize?: number;
30
+ init(...args: unknown[]): this;
31
+ register(format: string, callback: TryFileCompressor): void;
32
+ getLevel(value: string, fallback?: number): number | undefined;
33
+ getReadable(file: string | URL | Buffer): Readable;
34
+ createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
35
+ createBrotliCompress(file: string | Buffer, options?: CompressLevel): BrotliCompress;
36
+ createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
37
+ createWriteStreamAsBrotli(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
38
+ tryFile(file: string | Buffer, config: CompressFormat, callback?: TryFileResult): Promise<BufferResult>;
39
+ tryFile(file: string | Buffer, output: string, config: CompressFormat, callback?: TryFileResult): Promise<BufferResult>;
40
+ tryImage(file: string, config: CompressFormat, callback?: TryImageResult): Promise<BufferResult>;
41
+ tryImage(file: string | Buffer, output: string, config: CompressFormat, callback?: TryImageResult): Promise<BufferResult>;
42
+ get settings(): CompressSettings;
43
+ }
44
+
45
+ interface CompressConstructor extends ModuleConstructor {
46
+ singleton(): ICompress;
47
+ readonly prototype: ICompress;
48
+ new(module?: CompressModule): ICompress;
49
+ }
50
+ ```
51
+
52
+ ## References
53
+
54
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/squared.d.ts
55
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/compress.d.ts
56
+ - https://www.unpkg.com/@e-mc/types@0.8.4/lib/settings.d.ts
57
+
58
+ ## LICENSE
6
59
 
7
60
  BSD 3-Clause
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/compress",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Compress constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/anpham6/e-mc.git",
12
+ "url": "git+https://github.com/anpham6/e-mc.git",
13
13
  "directory": "src/compress"
14
14
  },
15
15
  "keywords": [
@@ -23,8 +23,8 @@
23
23
  "license": "BSD 3-Clause",
24
24
  "homepage": "https://github.com/anpham6/e-mc#readme",
25
25
  "dependencies": {
26
- "@e-mc/module": "0.8.2",
27
- "@e-mc/types": "0.8.2",
26
+ "@e-mc/module": "0.8.4",
27
+ "@e-mc/types": "0.8.4",
28
28
  "tinify": "^1.7.1",
29
29
  "wawoff2": "^2.0.1",
30
30
  "woff2sfnt-sfnt2woff": "^1.0.0"