@flystorage/file-storage 0.1.1 → 0.1.2

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
@@ -41,7 +41,7 @@ to, simply because they cannot be abstracted over in a reasonable manner.
41
41
  ### Implemented
42
42
  - [x] [Local Filesystem](https://www.npmjs.com/package/@flystorage/local-fs)
43
43
  - [x] [AWS S3 (using the V3 SDK)](https://www.npmjs.com/package/@flystorage/aws-s3)
44
- - [x] [Azure Blob Storage](https://www.npmjs.com/package/@flystorage/file-storage)
44
+ - [x] [Azure Blob Storage](https://www.npmjs.com/package/@flystorage/azure-storage-blob)
45
45
  - [x] [Test implementation (in-memory)](https://www.npmjs.com/package/@flystorage/in-memory)
46
46
  - [x] [Google Cloud Storage](https://www.npmjs.com/package/@flystorage/google-cloud-storage)
47
47
  - [x] [Chaos adapter decorator](https://www.npmjs.com/package/@flystorage/chaos)
@@ -75,7 +75,7 @@ import {LocalStorageAdapter} from '@flystorage/local-fs';
75
75
  **/
76
76
 
77
77
  const rootDirectory = resolve(process.cwd(), 'my-files');
78
- const storage = new FileStorage(new LocalFileStorage(rootDirectory));
78
+ const storage = new FileStorage(new LocalStorageAdapter(rootDirectory));
79
79
 
80
80
  /**
81
81
  * USAGE
@@ -20,144 +20,144 @@ export declare class ChecksumIsNotAvailable extends FlystorageError {
20
20
  readonly code = "flystorage.checksum_not_supported";
21
21
  constructor(message: string, algo: string, context?: ErrorContext, cause?: unknown);
22
22
  static checksumNotSupported: (algo: string, { context, cause }?: {
23
- context?: ErrorContext | undefined;
23
+ context?: ErrorContext;
24
24
  cause?: unknown;
25
25
  }) => ChecksumIsNotAvailable;
26
26
  }
27
27
  export declare class UnableToGetChecksum extends FlystorageError {
28
28
  readonly code = "flystorage.unable_to_get_checksum";
29
29
  static because: (reason: string, { context, cause }: {
30
- context?: ErrorContext | undefined;
30
+ context?: ErrorContext;
31
31
  cause?: unknown;
32
32
  }) => UnableToGetChecksum;
33
33
  }
34
34
  export declare class UnableToGetMimeType extends FlystorageError {
35
35
  readonly code = "flystorage.unable_to_get_mimetype";
36
36
  static because: (reason: string, { context, cause }: {
37
- context?: ErrorContext | undefined;
37
+ context?: ErrorContext;
38
38
  cause?: unknown;
39
39
  }) => UnableToGetMimeType;
40
40
  }
41
41
  export declare class UnableToGetLastModified extends FlystorageError {
42
42
  readonly code = "flystorage.unable_to_get_last_modified";
43
43
  static because: (reason: string, { context, cause }: {
44
- context?: ErrorContext | undefined;
44
+ context?: ErrorContext;
45
45
  cause?: unknown;
46
46
  }) => UnableToGetLastModified;
47
47
  }
48
48
  export declare class UnableToGetFileSize extends FlystorageError {
49
49
  readonly code = "flystorage.unable_to_get_file_size";
50
50
  static because: (reason: string, { context, cause }: {
51
- context?: ErrorContext | undefined;
51
+ context?: ErrorContext;
52
52
  cause?: unknown;
53
53
  }) => UnableToGetFileSize;
54
54
  }
55
55
  export declare class UnableToWriteFile extends FlystorageError {
56
56
  readonly code = "flystorage.unable_to_write_file";
57
57
  static because: (reason: string, { context, cause }: {
58
- context?: ErrorContext | undefined;
58
+ context?: ErrorContext;
59
59
  cause?: unknown;
60
60
  }) => UnableToWriteFile;
61
61
  }
62
62
  export declare class UnableToReadFile extends FlystorageError {
63
63
  readonly code = "flystorage.unable_to_read_file";
64
64
  static because: (reason: string, { context, cause }: {
65
- context?: ErrorContext | undefined;
65
+ context?: ErrorContext;
66
66
  cause?: unknown;
67
67
  }) => UnableToReadFile;
68
68
  }
69
69
  export declare class UnableToSetVisibility extends FlystorageError {
70
70
  readonly code = "flystorage.unable_to_set_visibility";
71
71
  static because: (reason: string, { context, cause }: {
72
- context?: ErrorContext | undefined;
72
+ context?: ErrorContext;
73
73
  cause?: unknown;
74
74
  }) => UnableToSetVisibility;
75
75
  }
76
76
  export declare class UnableToGetVisibility extends FlystorageError {
77
77
  readonly code = "flystorage.unable_to_get_visibility";
78
78
  static because: (reason: string, { context, cause }: {
79
- context?: ErrorContext | undefined;
79
+ context?: ErrorContext;
80
80
  cause?: unknown;
81
81
  }) => UnableToGetVisibility;
82
82
  }
83
83
  export declare class UnableToGetPublicUrl extends FlystorageError {
84
84
  readonly code = "flystorage.unable_to_get_public_url";
85
85
  static because: (reason: string, { context, cause }: {
86
- context?: ErrorContext | undefined;
86
+ context?: ErrorContext;
87
87
  cause?: unknown;
88
88
  }) => UnableToGetPublicUrl;
89
89
  }
90
90
  export declare class UnableToGetTemporaryUrl extends FlystorageError {
91
91
  readonly code = "flystorage.unable_to_get_temporary_url";
92
92
  static because: (reason: string, { context, cause }: {
93
- context?: ErrorContext | undefined;
93
+ context?: ErrorContext;
94
94
  cause?: unknown;
95
95
  }) => UnableToGetTemporaryUrl;
96
96
  }
97
97
  export declare class UnableToCopyFile extends FlystorageError {
98
98
  readonly code = "flystorage.unable_to_copy_file";
99
99
  static because: (reason: string, { context, cause }: {
100
- context?: ErrorContext | undefined;
100
+ context?: ErrorContext;
101
101
  cause?: unknown;
102
102
  }) => UnableToCopyFile;
103
103
  }
104
104
  export declare class UnableToMoveFile extends FlystorageError {
105
105
  readonly code = "flystorage.unable_to_move_file";
106
106
  static because: (reason: string, { context, cause }: {
107
- context?: ErrorContext | undefined;
107
+ context?: ErrorContext;
108
108
  cause?: unknown;
109
109
  }) => UnableToMoveFile;
110
110
  }
111
111
  export declare class UnableToGetStat extends FlystorageError {
112
112
  readonly code = "flystorage.unable_to_get_stat";
113
113
  static because: (reason: string, { context, cause }: {
114
- context?: ErrorContext | undefined;
114
+ context?: ErrorContext;
115
115
  cause?: unknown;
116
116
  }) => UnableToGetStat;
117
117
  static noFileStatResolved: ({ context, cause }: {
118
- context?: ErrorContext | undefined;
118
+ context?: ErrorContext;
119
119
  cause?: unknown;
120
120
  }) => UnableToGetStat;
121
121
  }
122
122
  export declare class UnableToCreateDirectory extends FlystorageError {
123
123
  readonly code = "flystorage.unable_to_create_directory";
124
124
  static because: (reason: string, { context, cause }: {
125
- context?: ErrorContext | undefined;
125
+ context?: ErrorContext;
126
126
  cause?: unknown;
127
127
  }) => UnableToCreateDirectory;
128
128
  }
129
129
  export declare class UnableToDeleteDirectory extends FlystorageError {
130
130
  readonly code = "flystorage.unable_to_delete_directory";
131
131
  static because: (reason: string, { context, cause }: {
132
- context?: ErrorContext | undefined;
132
+ context?: ErrorContext;
133
133
  cause?: unknown;
134
134
  }) => UnableToDeleteDirectory;
135
135
  }
136
136
  export declare class UnableToDeleteFile extends FlystorageError {
137
137
  readonly code = "flystorage.unable_to_delete_file";
138
138
  static because: (reason: string, { context, cause }: {
139
- context?: ErrorContext | undefined;
139
+ context?: ErrorContext;
140
140
  cause?: unknown;
141
141
  }) => UnableToDeleteFile;
142
142
  }
143
143
  export declare class UnableToCheckFileExistence extends FlystorageError {
144
144
  readonly code = "flystorage.unable_to_check_file_existence";
145
145
  static because: (reason: string, { context, cause }: {
146
- context?: ErrorContext | undefined;
146
+ context?: ErrorContext;
147
147
  cause?: unknown;
148
148
  }) => UnableToCheckFileExistence;
149
149
  }
150
150
  export declare class UnableToCheckDirectoryExistence extends FlystorageError {
151
151
  readonly code = "flystorage.unable_to_check_directory_existence";
152
152
  static because: (reason: string, { context, cause }: {
153
- context?: ErrorContext | undefined;
153
+ context?: ErrorContext;
154
154
  cause?: unknown;
155
155
  }) => UnableToCheckDirectoryExistence;
156
156
  }
157
157
  export declare class UnableToListDirectory extends FlystorageError {
158
158
  readonly code = "flystorage.unable_to_list_directory_contents";
159
159
  static because: (reason: string, { context, cause }: {
160
- context?: ErrorContext | undefined;
160
+ context?: ErrorContext;
161
161
  cause?: unknown;
162
162
  }) => UnableToListDirectory;
163
163
  }
@@ -72,6 +72,7 @@ export type VisibilityOptions = {
72
72
  export type WriteOptions = VisibilityOptions & MiscellaneousOptions & {
73
73
  mimeType?: string;
74
74
  size?: number;
75
+ cacheControl?: string;
75
76
  };
76
77
  export type CreateDirectoryOptions = MiscellaneousOptions & Pick<VisibilityOptions, 'directoryVisibility'> & {};
77
78
  export type PublicUrlOptions = MiscellaneousOptions & {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flystorage/file-storage",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
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",