spice-js 2.5.30 → 2.5.31

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.
@@ -92,12 +92,6 @@ class SpiceModel {
92
92
  }
93
93
  };
94
94
  this.deleted = false;
95
- /*
96
- if (args.args) {
97
- delete args.args["ctx"];
98
- }
99
- */
100
-
101
95
  this[_database] = new Database(args.connection || "default", {
102
96
  collection: args.collection,
103
97
  scope: args.scope
@@ -52,6 +52,28 @@ class Storage {
52
52
  })();
53
53
  }
54
54
 
55
+ download(_ref2) {
56
+ var _this2 = this;
57
+
58
+ return _asyncToGenerator(function* () {
59
+ var {
60
+ file,
61
+ bucket,
62
+ options
63
+ } = _ref2;
64
+
65
+ if (options) {
66
+ _this2.driver_options = _lodash.default.merge(_this2.driver_options, options);
67
+ }
68
+
69
+ var driver = new _this2.Driver(_this2.driver_options);
70
+ return yield driver.download({
71
+ file,
72
+ bucket
73
+ });
74
+ })();
75
+ }
76
+
55
77
  }
56
78
 
57
79
  exports.default = Storage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spice-js",
3
- "version": "2.5.30",
3
+ "version": "2.5.31",
4
4
  "description": "spice",
5
5
  "main": "build/index.js",
6
6
  "repository": {
@@ -77,12 +77,6 @@ export default class SpiceModel {
77
77
  };
78
78
 
79
79
  this.deleted = false;
80
-
81
- /*
82
- if (args.args) {
83
- delete args.args["ctx"];
84
- }
85
- */
86
80
  this[_database] = new Database(args.connection || "default", {
87
81
  collection: args.collection,
88
82
  scope: args.scope,
@@ -27,4 +27,15 @@ export default class Storage {
27
27
  : path,
28
28
  });
29
29
  }
30
+
31
+ async download({ file, bucket, options }) {
32
+ if (options) {
33
+ this.driver_options = _.merge(this.driver_options, options);
34
+ }
35
+ let driver = new this.Driver(this.driver_options);
36
+ return await driver.download({
37
+ file,
38
+ bucket,
39
+ });
40
+ }
30
41
  }