@naturalcycles/cloud-storage-lib 1.4.0 → 1.4.1

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.
@@ -59,7 +59,7 @@ class CloudStorage {
59
59
  .pipe((0, nodejs_lib_1.transformMapSimple)(f => fullPaths ? f.name : (0, js_lib_1._substringAfterLast)(f.name, '/')));
60
60
  }
61
61
  getFilesStream(bucketName, opt = {}) {
62
- const { prefix } = opt;
62
+ const { prefix, fullPaths = true } = opt;
63
63
  return this.storage
64
64
  .bucket(bucketName)
65
65
  .getFilesStream({
@@ -68,7 +68,7 @@ class CloudStorage {
68
68
  })
69
69
  .pipe((0, nodejs_lib_1.transformMap)(async (f) => {
70
70
  const [content] = await f.download();
71
- return { filePath: f.name, content };
71
+ return { filePath: fullPaths ? f.name : (0, js_lib_1._substringAfterLast)(f.name, '/'), content };
72
72
  }));
73
73
  }
74
74
  async getFile(bucketName, filePath) {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@naturalcycles/dev-lib": "^12.1.3",
14
- "@types/node": "^17.0.5",
14
+ "@types/node": "^16.0.0",
15
15
  "firebase-admin": "^10.0.1",
16
16
  "jest": "^27.1.0"
17
17
  },
@@ -35,7 +35,7 @@
35
35
  "engines": {
36
36
  "node": ">=14.16.0"
37
37
  },
38
- "version": "1.4.0",
38
+ "version": "1.4.1",
39
39
  "description": "",
40
40
  "author": "Natural Cycles Team",
41
41
  "license": "MIT"
@@ -87,7 +87,7 @@ export class CloudStorage implements CommonStorage {
87
87
  }
88
88
 
89
89
  getFilesStream(bucketName: string, opt: CommonStorageGetOptions = {}): ReadableTyped<FileEntry> {
90
- const { prefix } = opt
90
+ const { prefix, fullPaths = true } = opt
91
91
 
92
92
  return this.storage
93
93
  .bucket(bucketName)
@@ -98,7 +98,7 @@ export class CloudStorage implements CommonStorage {
98
98
  .pipe(
99
99
  transformMap<File, FileEntry>(async f => {
100
100
  const [content] = await f.download()
101
- return { filePath: f.name, content }
101
+ return { filePath: fullPaths ? f.name : _substringAfterLast(f.name, '/'), content }
102
102
  }),
103
103
  )
104
104
  }