@e-mc/file-manager 0.12.8 → 0.13.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.
Files changed (3) hide show
  1. package/README.md +29 -40
  2. package/index.js +363 -356
  3. package/package.json +11 -11
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @e-mc/file-manager
2
2
 
3
- * NodeJS 18
3
+ * NodeJS 18.20.5 LTS
4
4
  * ES2022
5
5
 
6
6
  ## General Usage
@@ -9,15 +9,15 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.12.7/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.13.0/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
- import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
15
+ import type { ChecksumValue, DataSource, IncrementalMatch, TaskAction } from "./squared";
16
16
 
17
17
  import type { DocumentConstructor, HostConstructor, ICloud, ICompress, IDocument, IHost, IImage, IModule, IRequest, ITask, IWatch, ImageConstructor, TaskConstructor, WatchConstructor } from "./index";
18
18
  import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from "./asset";
19
19
  import type { IPermission, PermissionReadWrite } from "./core";
20
- import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from "./filemanager";
20
+ import type { AssetContentOptions, CheckHashOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from "./filemanager";
21
21
  import type { ExecCommand } from "./logger";
22
22
  import type { CopyFileOptions, CreateDirOptions, DeleteFileOptions, MoveFileOptions, ReadFileOptions, RemoveDirOptions, WriteFileOptions } from "./module";
23
23
  import type { RequestData, Settings } from "./node";
@@ -96,8 +96,12 @@ interface IFileManager extends IHost, Set<string> {
96
96
  addDownload(value: number | Buffer | string, encoding: BufferEncoding): number;
97
97
  addDownload(value: number | Buffer | string, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
98
98
  getDownload(type?: number): [number, number];
99
+ checkHash(checksum: ChecksumValue, options: CheckHashOptions): boolean;
100
+ checkHash(checksum: ChecksumValue, data: Bufferable | null, uri: string | URL | undefined): boolean;
101
+ checkHash(checksum: ChecksumValue, data: Bufferable, options?: CheckHashOptions): boolean;
99
102
  transformAsset(data: IFileThread, parent?: ExternalAsset, override?: boolean): Promise<boolean>;
100
103
  addCopy(data: FileCommand<ExternalAsset>, saveAs?: string, replace?: boolean): string | undefined;
104
+ handleFilePermission(file: ExternalAsset): void;
101
105
  findMime(file: ExternalAsset, rename?: boolean): Promise<string>;
102
106
  getUTF8String(file: ExternalAsset, uri?: string): string;
103
107
  getBuffer(file: ExternalAsset, minStreamSize?: number): Promise<Buffer | null> | Buffer | null;
@@ -128,6 +132,7 @@ interface IFileManager extends IHost, Set<string> {
128
132
  finalizeChecksum(): Promise<void>;
129
133
  finalizeCleanup(): Promise<void>;
130
134
  finalize(): Promise<void>;
135
+ removeFiles(): void;
131
136
  close(): void;
132
137
  reset(): boolean;
133
138
  get baseDirectory(): string;
@@ -150,35 +155,11 @@ interface IFileManager extends IHost, Set<string> {
150
155
 
151
156
  /* EventEmitter */
152
157
  on(event: "end", listener: PostFinalizeCallback): this;
153
- on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
154
- on(event: "error", listener: (err: Error) => void): this;
155
- on(event: "file:read", listener: (src: string, data: Buffer | string, options?: ReadFileOptions) => void): this;
156
- on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
157
- on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
158
- on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
159
- on(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
160
- on(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
161
- on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
158
+ on(event: "asset:permission", listener: (file: ExternalAsset) => void): this;
162
159
  once(event: "end", listener: PostFinalizeCallback): this;
163
- once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
164
- once(event: "error", listener: (err: Error) => void): this;
165
- once(event: "file:read", listener: (src: string, data: Buffer | string, options?: ReadFileOptions) => void): this;
166
- once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
167
- once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
168
- once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
169
- once(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
170
- once(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
171
- once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
160
+ once(event: "asset:permission", listener: (file: ExternalAsset) => void): this;
172
161
  emit(event: "end", result: FinalizeResult): boolean;
173
- emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
174
- emit(event: "error", err: Error): boolean;
175
- emit(event: "file:read", src: string, data: Buffer | string, options?: ReadFileOptions): boolean;
176
- emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
177
- emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
178
- emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
179
- emit(event: "file:move", dest: string, options?: MoveFileOptions): boolean;
180
- emit(event: "dir:create", src: string, options?: CreateDirOptions): boolean;
181
- emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
162
+ emit(event: "asset:permission", file: ExternalAsset): boolean;
182
163
  }
183
164
 
184
165
  interface FileManagerConstructor extends HostConstructor {
@@ -211,6 +192,14 @@ interface ProcessModule {
211
192
  };
212
193
  }
213
194
 
195
+ interface MemoryModule {
196
+ settings?: {
197
+ stats?: {
198
+ file_count?: boolean;
199
+ };
200
+ };
201
+ }
202
+
214
203
  interface RequestModule {
215
204
  timeout?: number | string;
216
205
  disk?: {
@@ -307,15 +296,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
307
296
 
308
297
  ## References
309
298
 
310
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/squared.d.ts
311
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/asset.d.ts
312
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/core.d.ts
313
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/filemanager.d.ts
314
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/logger.d.ts
315
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/module.d.ts
316
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/node.d.ts
317
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/request.d.ts
318
- - https://www.unpkg.com/@e-mc/types@0.12.7/lib/settings.d.ts
299
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/squared.d.ts
300
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/asset.d.ts
301
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/core.d.ts
302
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/filemanager.d.ts
303
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/logger.d.ts
304
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/module.d.ts
305
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/node.d.ts
306
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/request.d.ts
307
+ - https://www.unpkg.com/@e-mc/types@0.13.0/lib/settings.d.ts
319
308
 
320
309
  * https://www.npmjs.com/package/@types/node
321
310