@spinajs/fs 2.0.180 → 2.0.181

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 (73) hide show
  1. package/lib/cjs/cli/rm.d.ts +11 -11
  2. package/lib/cjs/cli/rm.js +28 -28
  3. package/lib/cjs/cli/rm.js.map +1 -1
  4. package/lib/cjs/cli/stat.d.ts +10 -10
  5. package/lib/cjs/cli/stat.js +26 -26
  6. package/lib/cjs/cli/stat.js.map +1 -1
  7. package/lib/cjs/config/fs.d.ts +33 -16
  8. package/lib/cjs/config/fs.d.ts.map +1 -1
  9. package/lib/cjs/config/fs.js +50 -36
  10. package/lib/cjs/config/fs.js.map +1 -1
  11. package/lib/cjs/decorators.d.ts +7 -7
  12. package/lib/cjs/decorators.js +23 -23
  13. package/lib/cjs/file-hasher.d.ts +12 -8
  14. package/lib/cjs/file-hasher.d.ts.map +1 -1
  15. package/lib/cjs/file-hasher.js +51 -42
  16. package/lib/cjs/file-hasher.js.map +1 -1
  17. package/lib/cjs/file-info.d.ts +10 -10
  18. package/lib/cjs/file-info.js +124 -124
  19. package/lib/cjs/file-info.js.map +1 -1
  20. package/lib/cjs/index.d.ts +10 -10
  21. package/lib/cjs/index.d.ts.map +1 -1
  22. package/lib/cjs/index.js +72 -71
  23. package/lib/cjs/index.js.map +1 -1
  24. package/lib/cjs/interfaces.d.ts +180 -157
  25. package/lib/cjs/interfaces.d.ts.map +1 -1
  26. package/lib/cjs/interfaces.js +44 -33
  27. package/lib/cjs/interfaces.js.map +1 -1
  28. package/lib/cjs/local-provider.d.ts +96 -100
  29. package/lib/cjs/local-provider.d.ts.map +1 -1
  30. package/lib/cjs/local-provider.js +321 -278
  31. package/lib/cjs/local-provider.js.map +1 -1
  32. package/lib/cjs/local-temp-provider.d.ts +18 -18
  33. package/lib/cjs/local-temp-provider.d.ts.map +1 -1
  34. package/lib/cjs/local-temp-provider.js +59 -54
  35. package/lib/cjs/local-temp-provider.js.map +1 -1
  36. package/lib/mjs/cli/rm.d.ts +11 -11
  37. package/lib/mjs/cli/rm.js +25 -25
  38. package/lib/mjs/cli/rm.js.map +1 -1
  39. package/lib/mjs/cli/stat.d.ts +10 -10
  40. package/lib/mjs/cli/stat.js +23 -23
  41. package/lib/mjs/cli/stat.js.map +1 -1
  42. package/lib/mjs/config/fs.d.ts +33 -16
  43. package/lib/mjs/config/fs.d.ts.map +1 -1
  44. package/lib/mjs/config/fs.js +48 -34
  45. package/lib/mjs/config/fs.js.map +1 -1
  46. package/lib/mjs/decorators.d.ts +7 -7
  47. package/lib/mjs/decorators.js +19 -19
  48. package/lib/mjs/file-hasher.d.ts +12 -8
  49. package/lib/mjs/file-hasher.d.ts.map +1 -1
  50. package/lib/mjs/file-hasher.js +45 -36
  51. package/lib/mjs/file-hasher.js.map +1 -1
  52. package/lib/mjs/file-info.d.ts +10 -10
  53. package/lib/mjs/file-info.js +121 -121
  54. package/lib/mjs/file-info.js.map +1 -1
  55. package/lib/mjs/index.d.ts +10 -10
  56. package/lib/mjs/index.d.ts.map +1 -1
  57. package/lib/mjs/index.js +55 -54
  58. package/lib/mjs/index.js.map +1 -1
  59. package/lib/mjs/interfaces.d.ts +180 -157
  60. package/lib/mjs/interfaces.d.ts.map +1 -1
  61. package/lib/mjs/interfaces.js +38 -27
  62. package/lib/mjs/interfaces.js.map +1 -1
  63. package/lib/mjs/local-provider.d.ts +96 -100
  64. package/lib/mjs/local-provider.d.ts.map +1 -1
  65. package/lib/mjs/local-provider.js +315 -272
  66. package/lib/mjs/local-provider.js.map +1 -1
  67. package/lib/mjs/local-temp-provider.d.ts +18 -18
  68. package/lib/mjs/local-temp-provider.d.ts.map +1 -1
  69. package/lib/mjs/local-temp-provider.js +56 -51
  70. package/lib/mjs/local-temp-provider.js.map +1 -1
  71. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  72. package/lib/tsconfig.mjs.tsbuildinfo +1 -1
  73. package/package.json +6 -2
@@ -1,101 +1,97 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { ReadStream } from 'fs';
4
- import { fs, IFsLocalOptions, IStat, IZipResult } from './interfaces.js';
5
- import { Log } from '@spinajs/log-common';
6
- /**
7
- * Abstract layer for file operations.
8
- * Basic implementation is just wrapper for native node fs functions
9
- *
10
- * It allows to wrap other libs eg. aws s3, ftp
11
- * and inject it into code without changing logic that use them.
12
- *
13
- * TODO: map errors to some kind of common errors shared with other implementations
14
- */
15
- export declare class fsNative<T extends IFsLocalOptions> extends fs {
16
- Options: T;
17
- protected Logger: Log;
18
- /**
19
- * Name of provider. We can have multiple providers of the same type but with different options.
20
- * Also used in InjectService decorator for mapping
21
- */
22
- get Name(): string;
23
- constructor(Options: T);
24
- resolve(): Promise<void>;
25
- /**
26
- *
27
- * Tries to download file to local filesystem, then returns local filesystem path.
28
- * Native implementation simply returns local path and does nothing.
29
- *
30
- * @param path - file to download
31
- */
32
- download(path: string): Promise<string>;
33
- upload(srcPath: string, destPath?: string): Promise<void>;
34
- /**
35
- * read all content of file
36
- */
37
- read(path: string, encoding?: BufferEncoding): Promise<string | Buffer>;
38
- readStream(path: string, encoding?: BufferEncoding): Promise<ReadStream>;
39
- /**
40
- * Write to file string or buffer
41
- */
42
- write(path: string, data: string | Buffer, encoding: BufferEncoding): Promise<void>;
43
- append(path: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
44
- writeStream(path: string, rStream?: BufferEncoding | ReadStream, encoding?: BufferEncoding): Promise<import("fs").WriteStream>;
45
- /**
46
- * Checks if file existst
47
- * @param path - path to check
48
- */
49
- exists(path: string): Promise<boolean>;
50
- dirExists(path: string): Promise<boolean>;
51
- /**
52
- * Copy file to another location
53
- * @param path - src path
54
- * @param dest - dest path
55
- */
56
- copy(path: string, dest: string): Promise<void>;
57
- /**
58
- * Copy file to another location and deletes src file
59
- */
60
- move(oldPath: string, newPath: string): Promise<void>;
61
- /**
62
- * Change name of a file
63
- */
64
- rename(oldPath: string, newPath: string): Promise<void>;
65
- /**
66
- * Deletes file permanently
67
- *
68
- * @param path - path to file that will be deleted
69
- * @param onlyTemp - remote filesystems need to download file before, if so, calling unlink with this flag removes only local temp file after we finished processing
70
- */
71
- unlink(path: string, onlyTemp?: boolean): Promise<void>;
72
- /**
73
- *
74
- * Deletes dir recursively & all contents inside
75
- *
76
- * @param path - dir to remove
77
- */
78
- rm(path: string): Promise<void>;
79
- /**
80
- *
81
- * Creates directory, recursively
82
- *
83
- * @param path - directory to create
84
- */
85
- mkdir(path: string): Promise<void>;
86
- /**
87
- * Returns file statistics, not all fields may be accesible
88
- */
89
- stat(path: string): Promise<IStat>;
90
- tmppath(): string;
91
- /**
92
- * List content of directory
93
- *
94
- * @param path - path to directory
95
- */
96
- list(path: string): Promise<string[]>;
97
- unzip(path: string, destPath: string): Promise<void>;
98
- zip(path: string, zName?: string): Promise<IZipResult>;
99
- resolvePath(path: string): string;
100
- }
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { ReadStream } from 'fs';
5
+ import { fs, IFsLocalOptions, IStat, IZipResult } from './interfaces.js';
6
+ import { Log } from '@spinajs/log-common';
7
+ /**
8
+ * Abstract layer for file operations.
9
+ * Basic implementation is just wrapper for native node fs functions
10
+ *
11
+ * It allows to wrap other libs eg. aws s3, ftp
12
+ * and inject it into code without changing logic that use them.
13
+ *
14
+ * TODO: map errors to some kind of common errors shared with other implementations
15
+ */
16
+ export declare class fsNative<T extends IFsLocalOptions> extends fs {
17
+ Options: T;
18
+ protected Logger: Log;
19
+ /**
20
+ * Name of provider. We can have multiple providers of the same type but with different options.
21
+ * Also used in InjectService decorator for mapping
22
+ */
23
+ get Name(): string;
24
+ constructor(Options: T);
25
+ resolve(): Promise<void>;
26
+ /**
27
+ *
28
+ * Tries to download file to local filesystem, then returns local filesystem path.
29
+ * Native implementation simply returns local path and does nothing.
30
+ *
31
+ * @param path - file to download
32
+ */
33
+ download(path: string): Promise<string>;
34
+ upload(srcPath: string, destPath?: string): Promise<void>;
35
+ /**
36
+ * read all content of file
37
+ */
38
+ read(path: string, encoding?: BufferEncoding): Promise<string | Buffer>;
39
+ readStream(path: string, encoding?: BufferEncoding): Promise<ReadStream>;
40
+ /**
41
+ * Write to file string or buffer
42
+ */
43
+ write(path: string, data: string | Buffer, encoding: BufferEncoding): Promise<void>;
44
+ append(path: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
45
+ writeStream(path: string, rStream?: BufferEncoding | NodeJS.ReadStream, encoding?: BufferEncoding): Promise<import("fs").WriteStream>;
46
+ /**
47
+ * Checks if file existst
48
+ * @param path - path to check
49
+ */
50
+ exists(path: string): Promise<boolean>;
51
+ dirExists(path: string): Promise<boolean>;
52
+ /**
53
+ * Copy file or dir to another location
54
+ * @param path - src path
55
+ * @param dest - dest path
56
+ */
57
+ copy(path: string, dest: string, dstFs?: fs): Promise<void>;
58
+ /**
59
+ * Copy file to another location and deletes src file
60
+ */
61
+ move(oldPath: string, newPath: string, dstFs?: fs): Promise<void>;
62
+ /**
63
+ * Change name of a file
64
+ */
65
+ rename(oldPath: string, newPath: string): Promise<void>;
66
+ /**
67
+ *
68
+ * Deletes file OR
69
+ * Deletes dir recursively & all contents inside
70
+ *
71
+ * @param path - dir to remove
72
+ */
73
+ rm(path: string): Promise<void>;
74
+ /**
75
+ *
76
+ * Creates directory, recursively
77
+ *
78
+ * @param path - directory to create
79
+ */
80
+ mkdir(path: string): Promise<void>;
81
+ /**
82
+ * Returns file statistics, not all fields may be accesible
83
+ */
84
+ stat(path: string): Promise<IStat>;
85
+ tmppath(): string;
86
+ /**
87
+ * List content of directory
88
+ *
89
+ * @param path - path to directory
90
+ */
91
+ list(path: string): Promise<string[]>;
92
+ unzip(path: string, destPath?: string, dstFs?: fs): Promise<void>;
93
+ isDir(path: string): Promise<boolean>;
94
+ zip(path: string | string[], dstFs?: fs, dstFile?: string): Promise<IZipResult>;
95
+ resolvePath(path: string): string;
96
+ }
101
97
  //# sourceMappingURL=local-provider.d.ts.map
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