@flystorage/file-storage 0.0.9 → 0.1.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 +6 -11
- package/dist/cjs/file-storage.js +6 -0
- package/dist/esm/file-storage.js +6 -0
- package/dist/types/file-storage.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<img src="https://avatars.githubusercontent.com/u/151840999" width="50px" height="50px" />
|
|
2
2
|
|
|
3
|
-
# Flystorage
|
|
3
|
+
# Flystorage
|
|
4
4
|
Flystorage is a file storage abstraction for NodeJS and TypeScript. It is an 80/20 solution
|
|
5
5
|
that is built around a set of goals:
|
|
6
6
|
|
|
@@ -43,14 +43,10 @@ to, simply because they cannot be abstracted over in a reasonable manner.
|
|
|
43
43
|
- [x] AWS S3 (using the V3 SDK)
|
|
44
44
|
- [x] Azure Blob Storage
|
|
45
45
|
- [x] Test implementation (in-memory)
|
|
46
|
+
- [x] Google Cloud Storage
|
|
47
|
+
- [x] Chaos adapter decorator
|
|
46
48
|
|
|
47
49
|
### Planned
|
|
48
|
-
|
|
49
|
-
#### Prio 1
|
|
50
|
-
- [ ] Failure decorator (stage errors for tests)
|
|
51
|
-
- [ ] Google Cloud Storage
|
|
52
|
-
|
|
53
|
-
### Prio 2
|
|
54
50
|
- [ ] FTP (using `basic-ftp`)
|
|
55
51
|
- [ ] SFTP (?)
|
|
56
52
|
|
|
@@ -72,7 +68,7 @@ npm i -S @flystorage/local-fs
|
|
|
72
68
|
import {resolve} from 'node:path';
|
|
73
69
|
import {createReadStream} from 'node:fs';
|
|
74
70
|
import {FileStorage, Visibility} from '@flystorage/file-storage';
|
|
75
|
-
import {
|
|
71
|
+
import {LocalStorageAdapter} from '@flystorage/local-fs';
|
|
76
72
|
|
|
77
73
|
/**
|
|
78
74
|
* SETUP
|
|
@@ -122,6 +118,5 @@ await storage.deleteDirectory('some-directory');
|
|
|
122
118
|
|
|
123
119
|
## Author
|
|
124
120
|
Flystorage is built by the maintainer of [Flysystem](https://flysystem.thephpleague.com), a
|
|
125
|
-
filesystem abstraction for PHP. This brings along
|
|
126
|
-
a decade of
|
|
127
|
-
and weighing trade-offs to make a usable API.
|
|
121
|
+
filesystem abstraction for PHP. This brings along over
|
|
122
|
+
a decade of filesystem abstraction experience.
|
package/dist/cjs/file-storage.js
CHANGED
|
@@ -149,7 +149,13 @@ class FileStorage {
|
|
|
149
149
|
throw errors.UnableToCopyFile.because(errors.errorToMessage(error), { cause: error, context: { from, to } });
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated use changeVisibility instead
|
|
154
|
+
*/
|
|
152
155
|
async setVisibility(path, visibility) {
|
|
156
|
+
return this.changeVisibility(path, visibility);
|
|
157
|
+
}
|
|
158
|
+
async changeVisibility(path, visibility) {
|
|
153
159
|
try {
|
|
154
160
|
return await this.adapter.changeVisibility(this.pathNormalizer.normalizePath(path), visibility);
|
|
155
161
|
}
|
package/dist/esm/file-storage.js
CHANGED
|
@@ -142,7 +142,13 @@ export class FileStorage {
|
|
|
142
142
|
throw errors.UnableToCopyFile.because(errors.errorToMessage(error), { cause: error, context: { from, to } });
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* @deprecated use changeVisibility instead
|
|
147
|
+
*/
|
|
145
148
|
async setVisibility(path, visibility) {
|
|
149
|
+
return this.changeVisibility(path, visibility);
|
|
150
|
+
}
|
|
151
|
+
async changeVisibility(path, visibility) {
|
|
146
152
|
try {
|
|
147
153
|
return await this.adapter.changeVisibility(this.pathNormalizer.normalizePath(path), visibility);
|
|
148
154
|
}
|
|
@@ -118,7 +118,11 @@ export declare class FileStorage {
|
|
|
118
118
|
stat(path: string): Promise<StatEntry>;
|
|
119
119
|
moveFile(from: string, to: string, options?: MoveFileOptions): Promise<void>;
|
|
120
120
|
copyFile(from: string, to: string, options?: CopyFileOptions): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated use changeVisibility instead
|
|
123
|
+
*/
|
|
121
124
|
setVisibility(path: string, visibility: string): Promise<void>;
|
|
125
|
+
changeVisibility(path: string, visibility: string): Promise<void>;
|
|
122
126
|
visibility(path: string): Promise<string>;
|
|
123
127
|
fileExists(path: string): Promise<boolean>;
|
|
124
128
|
list(path: string, { deep }?: ListOptions): DirectoryListing;
|
package/package.json
CHANGED