@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  <img src="https://avatars.githubusercontent.com/u/151840999" width="50px" height="50px" />
2
2
 
3
- # Flystorage (work in progress)
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 {LocalFileStorage} from '@flystorage/local-fs';
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 more than
126
- a decade of smoothing over filesystem implementation differences
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.
@@ -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
  }
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flystorage/file-storage",
3
3
  "type": "module",
4
- "version": "0.0.9",
4
+ "version": "0.1.0",
5
5
  "description": "File-storage abstraction: multiple filesystems, one API.",
6
6
  "main": "./dist/cjs/index.js",
7
7
  "types": "./dist/types/index.d.ts",