@spinajs/fs-s3 2.0.38 → 2.0.44

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/lib/index.d.ts CHANGED
@@ -0,0 +1,111 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { ILog } from '@spinajs/log';
5
+ import { fs, IStat, IZipResult } from '@spinajs/fs';
6
+ import * as AWS from 'aws-sdk';
7
+ import stream from 'stream';
8
+ export interface IS3Config {
9
+ bucket: string;
10
+ name: string;
11
+ }
12
+ /**
13
+ * Abstract layer for file operations.
14
+ * Basic implementation is just wrapper for native node fs functions
15
+ *
16
+ * It allows to wrap other libs eg. aws s3, ftp
17
+ * and inject it into code without changing logic that use them.
18
+ *
19
+ * TODO: map errors to some kind of common errors shared with other implementations
20
+ */
21
+ export declare class fsS3 extends fs {
22
+ Options: IS3Config;
23
+ protected Logger: ILog;
24
+ protected S3: AWS.S3;
25
+ protected AwsConfig: AWS.ConfigurationOptions;
26
+ protected ConfigPath: string;
27
+ /**
28
+ * File system for temporary files
29
+ */
30
+ protected TempFs: fs;
31
+ /**
32
+ * Name of provider. We can have multiple providers of the same type but with different options.
33
+ * Also used in InjectService decorator for mapping
34
+ */
35
+ get Name(): string;
36
+ constructor(Options: IS3Config);
37
+ resolve(): Promise<void>;
38
+ /**
39
+ *
40
+ * Tries to download file to local filesystem, then returns local filesystem path.
41
+ * Native implementation simply returns local path and does nothing.
42
+ *
43
+ * @param path - file to download
44
+ */
45
+ download(path: string): Promise<string>;
46
+ /**
47
+ * read all content of file
48
+ */
49
+ read(path: string, encoding: BufferEncoding): Promise<string | Buffer>;
50
+ readStream(path: string, encoding?: BufferEncoding): Promise<import("fs").ReadStream>;
51
+ /**
52
+ * Write to file string or buffer
53
+ */
54
+ write(path: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
55
+ append(path: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
56
+ writeStream(path: string, encoding?: BufferEncoding): Promise<stream.PassThrough>;
57
+ /**
58
+ * Checks if file existst
59
+ * @param path - path to check
60
+ */
61
+ exists(path: string): Promise<boolean>;
62
+ dirExists(): Promise<boolean>;
63
+ /**
64
+ * Copy file to another location
65
+ * @param path - src path
66
+ * @param dest - dest path
67
+ */
68
+ copy(path: string, dest: string): Promise<void>;
69
+ /**
70
+ * Copy file to another location and deletes src file
71
+ */
72
+ move(oldPath: string, newPath: string): Promise<void>;
73
+ /**
74
+ * Change name of a file
75
+ */
76
+ rename(oldPath: string, newPath: string): Promise<void>;
77
+ /**
78
+ * Deletes file permanently
79
+ *
80
+ * @param path - path to file that will be deleted
81
+ * @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
82
+ */
83
+ unlink(path: string, onlyTemp?: boolean): Promise<void>;
84
+ /**
85
+ *
86
+ * Deletes dir recursively & all contents inside
87
+ *
88
+ * @param path - dir to remove
89
+ */
90
+ rm(_path: string): Promise<void>;
91
+ /**
92
+ *
93
+ * Creates directory, recursively
94
+ *
95
+ */
96
+ mkdir(): Promise<void>;
97
+ /**
98
+ * Returns file statistics, not all fields may be accesible
99
+ */
100
+ stat(path: string): Promise<IStat>;
101
+ protected getSignedUrl(path: string): Promise<string>;
102
+ tmppath(): string;
103
+ /**
104
+ * List content of directory
105
+ *
106
+ * @param path - path to directory
107
+ */
108
+ list(path: string): Promise<string[]>;
109
+ zip(path: string, zName?: string): Promise<IZipResult>;
110
+ protected resolvePath(): void;
111
+ }
package/lib/index.js CHANGED
@@ -1 +1,361 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.fsS3 = void 0;
39
+ /* eslint-disable promise/always-return */
40
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
41
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
42
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
43
+ /* eslint-disable security/detect-non-literal-fs-filename */
44
+ const di_1 = require("@spinajs/di");
45
+ const log_1 = require("@spinajs/log");
46
+ const fs_1 = require("@spinajs/fs");
47
+ const AWS = __importStar(require("aws-sdk"));
48
+ const configuration_1 = require("@spinajs/configuration");
49
+ const archiver_1 = __importDefault(require("archiver"));
50
+ const path_1 = require("path");
51
+ const exceptions_1 = require("@spinajs/exceptions");
52
+ const fs_2 = require("fs");
53
+ const luxon_1 = require("luxon");
54
+ const stream_1 = __importDefault(require("stream"));
55
+ /**
56
+ * Abstract layer for file operations.
57
+ * Basic implementation is just wrapper for native node fs functions
58
+ *
59
+ * It allows to wrap other libs eg. aws s3, ftp
60
+ * and inject it into code without changing logic that use them.
61
+ *
62
+ * TODO: map errors to some kind of common errors shared with other implementations
63
+ */
64
+ let fsS3 = class fsS3 extends fs_1.fs {
65
+ constructor(Options) {
66
+ super();
67
+ this.Options = Options;
68
+ }
69
+ /**
70
+ * Name of provider. We can have multiple providers of the same type but with different options.
71
+ * Also used in InjectService decorator for mapping
72
+ */
73
+ get Name() {
74
+ return this.Options.name;
75
+ }
76
+ async resolve() {
77
+ AWS.config.update(this.AwsConfig);
78
+ if (this.ConfigPath) {
79
+ AWS.config.loadFromPath(this.ConfigPath);
80
+ }
81
+ else if (this.AwsConfig) {
82
+ AWS.config.update(this.AwsConfig);
83
+ }
84
+ this.S3 = new AWS.S3();
85
+ this.TempFs = await di_1.DI.resolve('__file_provider__', ['fs-temp']);
86
+ }
87
+ /**
88
+ *
89
+ * Tries to download file to local filesystem, then returns local filesystem path.
90
+ * Native implementation simply returns local path and does nothing.
91
+ *
92
+ * @param path - file to download
93
+ */
94
+ async download(path) {
95
+ const tmpName = this.TempFs.tmppath();
96
+ const wStream = await this.TempFs.writeStream(tmpName);
97
+ return new Promise((resolve, reject) => {
98
+ this.S3.getObject({
99
+ Bucket: this.Options.bucket,
100
+ Key: path,
101
+ })
102
+ .on('error', (err) => {
103
+ reject(err);
104
+ })
105
+ .on('httpData', (chunk) => {
106
+ wStream.write(chunk);
107
+ })
108
+ .on('httpDone', () => {
109
+ wStream.end();
110
+ this.Logger.trace(`Downloaded file from S3 bucket ${this.Options.bucket}, file: ${path}`);
111
+ resolve(tmpName);
112
+ });
113
+ });
114
+ }
115
+ /**
116
+ * read all content of file
117
+ */
118
+ async read(path, encoding) {
119
+ const fLocal = await this.download(path);
120
+ const content = this.TempFs.read(fLocal, encoding);
121
+ await this.TempFs.unlink(fLocal);
122
+ return content;
123
+ }
124
+ async readStream(path, encoding) {
125
+ const fLocal = await this.download(path);
126
+ return this.TempFs.readStream(fLocal, encoding);
127
+ }
128
+ /**
129
+ * Write to file string or buffer
130
+ */
131
+ async write(path, data, encoding) {
132
+ await this.S3.upload({
133
+ Bucket: this.Options.bucket,
134
+ Key: path,
135
+ Body: data,
136
+ ContentEncoding: encoding,
137
+ }).promise();
138
+ }
139
+ async append(path, data, encoding) {
140
+ /**
141
+ * We cannot append to file in s3 directly,
142
+ * we have to download file firs, append locally, then upload again new file
143
+ */
144
+ const fLocal = await this.download(path);
145
+ await this.TempFs.append(fLocal, data, encoding);
146
+ const wStream = await this.writeStream(path, encoding);
147
+ const rStream = await this.TempFs.readStream(fLocal, encoding);
148
+ return new Promise((resolve, reject) => {
149
+ rStream
150
+ .pipe(wStream)
151
+ .on('end', () => {
152
+ this.TempFs.rm(fLocal)
153
+ .then(() => {
154
+ resolve();
155
+ })
156
+ .catch(() => {
157
+ resolve();
158
+ });
159
+ })
160
+ .on('error', (err) => {
161
+ // eslint-disable-next-line promise/no-promise-in-callback
162
+ this.TempFs.rm(fLocal)
163
+ .then(() => {
164
+ reject(err);
165
+ })
166
+ .catch(() => {
167
+ reject(err);
168
+ });
169
+ });
170
+ });
171
+ }
172
+ async writeStream(path, encoding) {
173
+ const s = new stream_1.default.PassThrough();
174
+ this.S3.upload({
175
+ Bucket: this.Options.bucket,
176
+ Key: path,
177
+ Body: s,
178
+ ContentEncoding: encoding,
179
+ }, (err) => {
180
+ if (err) {
181
+ this.Logger.error(`Cannot write file ${path} as stream to s3 bucket`);
182
+ }
183
+ });
184
+ return Promise.resolve(s);
185
+ }
186
+ /**
187
+ * Checks if file existst
188
+ * @param path - path to check
189
+ */
190
+ async exists(path) {
191
+ try {
192
+ await this.S3.headObject({
193
+ Bucket: this.Options.bucket,
194
+ Key: path,
195
+ }).promise();
196
+ }
197
+ catch (err) {
198
+ if (err.name === 'ResourceNotFoundException') {
199
+ return false;
200
+ }
201
+ }
202
+ return true;
203
+ }
204
+ async dirExists() {
205
+ // s3 does not have concept of folders
206
+ // we assume that all exists
207
+ return Promise.resolve(true);
208
+ }
209
+ /**
210
+ * Copy file to another location
211
+ * @param path - src path
212
+ * @param dest - dest path
213
+ */
214
+ async copy(path, dest) {
215
+ const copyparams = {
216
+ Bucket: this.Options.bucket,
217
+ CopySource: this.Options.bucket + '/' + path,
218
+ Key: dest,
219
+ };
220
+ await this.S3.copyObject(copyparams).promise();
221
+ }
222
+ /**
223
+ * Copy file to another location and deletes src file
224
+ */
225
+ async move(oldPath, newPath) {
226
+ await this.copy(oldPath, newPath);
227
+ await this.unlink(oldPath);
228
+ }
229
+ /**
230
+ * Change name of a file
231
+ */
232
+ async rename(oldPath, newPath) {
233
+ return this.move(oldPath, newPath);
234
+ }
235
+ /**
236
+ * Deletes file permanently
237
+ *
238
+ * @param path - path to file that will be deleted
239
+ * @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
240
+ */
241
+ async unlink(path, onlyTemp) {
242
+ if (onlyTemp) {
243
+ await this.TempFs.unlink(path);
244
+ return;
245
+ }
246
+ await this.S3.deleteObject({
247
+ Key: path,
248
+ Bucket: this.Options.bucket,
249
+ }).promise();
250
+ }
251
+ /**
252
+ *
253
+ * Deletes dir recursively & all contents inside
254
+ *
255
+ * @param path - dir to remove
256
+ */
257
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
258
+ async rm(_path) {
259
+ // s3 is not deleting folders
260
+ }
261
+ /**
262
+ *
263
+ * Creates directory, recursively
264
+ *
265
+ */
266
+ async mkdir() {
267
+ // s3 dont need to create folders
268
+ }
269
+ /**
270
+ * Returns file statistics, not all fields may be accesible
271
+ */
272
+ async stat(path) {
273
+ const result = await this.S3.headObject({
274
+ Bucket: this.Options.bucket,
275
+ Key: path,
276
+ }).promise();
277
+ return {
278
+ // no directories in s3
279
+ IsDirectory: false,
280
+ // only files can be stored in s3
281
+ IsFile: true,
282
+ // no creation time
283
+ CreationTime: luxon_1.DateTime.min(),
284
+ ModifiedTime: luxon_1.DateTime.fromJSDate(result.LastModified),
285
+ // no access time in s3
286
+ AccessTime: luxon_1.DateTime.min(),
287
+ Size: result.ContentLength,
288
+ };
289
+ }
290
+ async getSignedUrl(path) {
291
+ return this.S3.getSignedUrlPromise('getObject', {
292
+ Bucket: this.Options.bucket,
293
+ Key: path,
294
+ Expires: 24 * 60 * 60,
295
+ });
296
+ }
297
+ tmppath() {
298
+ throw new exceptions_1.MethodNotImplemented('fs s3 does not support temporary paths');
299
+ }
300
+ /**
301
+ * List content of directory
302
+ *
303
+ * @param path - path to directory
304
+ */
305
+ async list(path) {
306
+ const params = {
307
+ Bucket: this.Options.bucket,
308
+ Delimiter: '/',
309
+ Prefix: path,
310
+ };
311
+ // TODO: support more than 1000 items using continuation token
312
+ const result = await this.S3.listObjectsV2(params).promise();
313
+ return result.Contents.map((x) => x.Key);
314
+ }
315
+ async zip(path, zName) {
316
+ const zTmpName = this.TempFs.tmppath();
317
+ const output = await this.TempFs.writeStream(zTmpName);
318
+ const archive = (0, archiver_1.default)('zip', {
319
+ zlib: { level: 9 }, // Sets the compression level.
320
+ });
321
+ // pipe archive data to the file
322
+ archive.pipe(output);
323
+ const tFile = await this.download(path);
324
+ archive.file(tFile, { name: zName !== null && zName !== void 0 ? zName : (0, path_1.basename)(path) });
325
+ await archive.finalize();
326
+ return {
327
+ asFilePath: () => {
328
+ return zTmpName;
329
+ },
330
+ asStream: (encoding) => {
331
+ return (0, fs_2.createReadStream)(zTmpName, encoding);
332
+ },
333
+ asBase64: () => {
334
+ return (0, fs_2.readFileSync)(zTmpName, 'base64');
335
+ },
336
+ };
337
+ }
338
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
339
+ resolvePath() {
340
+ throw new exceptions_1.MethodNotImplemented('fs s3 does not support path resolving');
341
+ }
342
+ };
343
+ __decorate([
344
+ (0, log_1.Logger)('fs'),
345
+ __metadata("design:type", Object)
346
+ ], fsS3.prototype, "Logger", void 0);
347
+ __decorate([
348
+ (0, configuration_1.Config)('fs.s3.config'),
349
+ __metadata("design:type", AWS.ConfigurationOptions)
350
+ ], fsS3.prototype, "AwsConfig", void 0);
351
+ __decorate([
352
+ (0, configuration_1.Config)('fs.s3.configPath'),
353
+ __metadata("design:type", String)
354
+ ], fsS3.prototype, "ConfigPath", void 0);
355
+ fsS3 = __decorate([
356
+ (0, di_1.Injectable)('fs'),
357
+ (0, di_1.PerInstanceCheck)(),
358
+ __metadata("design:paramtypes", [Object])
359
+ ], fsS3);
360
+ exports.fsS3 = fsS3;
1
361
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA0C;AAC1C,sDAAsD;AACtD,+DAA+D;AAC/D,4DAA4D;AAC5D,4DAA4D;AAC5D,oCAA+D;AAC/D,sCAA4C;AAC5C,oCAAoD;AACpD,6CAA+B;AAC/B,0DAAgD;AAChD,wDAAgC;AAChC,+BAAgC;AAChC,oDAA2D;AAC3D,2BAAoD;AACpD,iCAAiC;AACjC,oDAA4B;AAO5B;;;;;;;;GAQG;AAGH,IAAa,IAAI,GAAjB,MAAa,IAAK,SAAQ,OAAE;IAyB1B,YAAmB,OAAkB;QACnC,KAAK,EAAE,CAAC;QADS,YAAO,GAAP,OAAO,CAAW;IAErC,CAAC;IAVD;;;OAGG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,C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,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEvD,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;QAEzB,OAAO;YACL,UAAU,EAAE,GAAG,EAAE;gBACf,OAAO,QAAQ,CAAC;YAClB,CAAC;YACD,QAAQ,EAAE,CAAC,QAAyB,EAAE,EAAE;gBACtC,OAAO,IAAA,qBAAgB,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC9C,CAAC;YACD,QAAQ,EAAE,GAAG,EAAE;gBACb,OAAO,IAAA,iBAAY,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC1C,CAAC;SACF,CAAC;IACJ,CAAC;IAED,gEAAgE;IACtD,WAAW;QACnB,MAAM,IAAI,iCAAoB,CAAC,uCAAuC,CAAC,CAAC;IAC1E,CAAC;CACF,CAAA;AAlVC;IADC,IAAA,YAAM,EAAC,IAAI,CAAC;;oCACU;AAKvB;IADC,IAAA,sBAAM,EAAC,cAAc,CAAC;8BACF,GAAG,CAAC,oBAAoB;uCAAC;AAG9C;IADC,IAAA,sBAAM,EAAC,kBAAkB,CAAC;;wCACE;AAVlB,IAAI;IAFhB,IAAA,eAAU,EAAC,IAAI,CAAC;IAChB,IAAA,qBAAgB,GAAE;;GACN,IAAI,CAoVhB;AApVY,oBAAI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spinajs/fs-s3",
3
- "version": "2.0.38",
3
+ "version": "2.0.44",
4
4
  "description": "file operations implementation for aws s3 storage",
5
5
  "main": "lib/index.js",
6
6
  "private": false,
@@ -38,8 +38,18 @@
38
38
  "url": "https://github.com/spinajs/exceptions/issues"
39
39
  },
40
40
  "homepage": "https://github.com/spinajs/exceptions#readme",
41
- "gitHead": "5ea5440ee9db49595f531592ebdbc6d69f457082",
41
+ "gitHead": "1857a6e3626e0fed22ffb0b44b48d587c79898db",
42
+ "devDependencies": {
43
+ "@types/archiver": "^5.3.1"
44
+ },
42
45
  "dependencies": {
43
- "lodash": "^4.17.21"
46
+ "@spinajs/configuration": "^2.0.44",
47
+ "@spinajs/di": "^2.0.44",
48
+ "@spinajs/fs": "^2.0.44",
49
+ "@spinajs/log": "^2.0.44",
50
+ "archiver": "^5.3.1",
51
+ "aws-sdk": "^2.1223.0",
52
+ "lodash": "^4.17.21",
53
+ "luxon": "^3.2.1"
44
54
  }
45
55
  }