files.com 1.0.255 → 1.0.257

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -152,6 +152,9 @@ You can set the following global properties using static methods on the `Files`
152
152
 
153
153
  // download to a writable stream
154
154
  await downloadableFile.downloadToStream(stream)
155
+
156
+ // download in memory and return as a UTF-8 string
157
+ const textContent = await downloadableFile.downloadToString()
155
158
  }
156
159
 
157
160
  ### Additional Object Documentation
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.255
1
+ 1.0.257
@@ -322,6 +322,7 @@ await file.begin_upload({
322
322
  "http_method": "PUT",
323
323
  "next_partsize": 1,
324
324
  "parallel_parts": true,
325
+ "retry_parts": true,
325
326
  "parameters": {
326
327
  "key": "example value"
327
328
  },
@@ -17,6 +17,7 @@
17
17
  "http_method": "PUT",
18
18
  "next_partsize": 1,
19
19
  "parallel_parts": true,
20
+ "retry_parts": true,
20
21
  "parameters": {
21
22
  "key": "example value"
22
23
  },
@@ -37,6 +38,7 @@
37
38
  * `http_method` (string): HTTP Method to use for uploading the part, usually `PUT`
38
39
  * `next_partsize` (int64): Size in bytes for this part
39
40
  * `parallel_parts` (boolean): If `true`, multiple parts may be uploaded in parallel. If `false`, be sure to only upload one part at a time, in order.
41
+ * `retry_parts` (boolean): If `true`, parts may be retried. If `false`, a part cannot be retried and the upload should be restarted.
40
42
  * `parameters` (object): Additional HTTP parameters to send with the upload
41
43
  * `part_number` (int64): Number of this upload part
42
44
  * `partsize` (int64): Size in bytes for the next upload part
@@ -17,7 +17,6 @@
17
17
  * `note` (string): A note sent to the recipient with the inbox.
18
18
  * `recipient` (string): The recipient's email address.
19
19
  * `sent_at` (date-time): When the Inbox was shared with this recipient.
20
- * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
21
20
  * `inbox_id` (int64): Inbox to share.
22
21
  * `share_after_create` (boolean): Set to true to share the link with the recipient upon creation.
23
22
 
@@ -27,7 +26,6 @@
27
26
 
28
27
  ```
29
28
  await InboxRecipient.list({
30
- 'user_id': 1,
31
29
  'per_page': 1,
32
30
  'inbox_id': 1,
33
31
  })
@@ -36,7 +34,6 @@ await InboxRecipient.list({
36
34
 
37
35
  ### Parameters
38
36
 
39
- * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
40
37
  * `cursor` (string): Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
41
38
  * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
42
39
  * `sort_by` (object): If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[has_registrations]=desc`). Valid fields are `has_registrations`.
@@ -49,7 +46,6 @@ await InboxRecipient.list({
49
46
 
50
47
  ```
51
48
  await InboxRecipient.create({
52
- 'user_id': 1,
53
49
  'inbox_id': 1,
54
50
  'recipient': "johndoe@gmail.com",
55
51
  'name': "John Smith",
@@ -62,7 +58,6 @@ await InboxRecipient.create({
62
58
 
63
59
  ### Parameters
64
60
 
65
- * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
66
61
  * `inbox_id` (int64): Required - Inbox to share.
67
62
  * `recipient` (string): Required - Email address to share this inbox with.
68
63
  * `name` (string): Name of recipient.
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.saveUrlToStream = exports.saveUrlToFile = exports.openDiskFileWriteStream = exports.openDiskFileReadStream = void 0;
5
+ exports.saveUrlToString = exports.saveUrlToStream = exports.saveUrlToFile = exports.openDiskFileWriteStream = exports.openDiskFileReadStream = void 0;
6
6
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
7
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
8
  var openDiskFileReadStream = function openDiskFileReadStream(sourceFilePath) {
@@ -40,25 +40,55 @@ var saveUrlToStream = /*#__PURE__*/function () {
40
40
  };
41
41
  }();
42
42
  exports.saveUrlToStream = saveUrlToStream;
43
- var saveUrlToFile = /*#__PURE__*/function () {
44
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url, destinationPath) {
45
- var stream;
43
+ var saveUrlToString = /*#__PURE__*/function () {
44
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
46
45
  return _regenerator.default.wrap(function _callee2$(_context2) {
47
46
  while (1) switch (_context2.prev = _context2.next) {
47
+ case 0:
48
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
49
+ var https = require('https');
50
+ https.get(url, function (response) {
51
+ var chunks = [];
52
+ response.on('data', function (chunk) {
53
+ return chunks.push(Buffer.from(chunk));
54
+ });
55
+ response.on('end', function () {
56
+ return resolve(Buffer.concat(chunks).toString('utf8'));
57
+ });
58
+ }).on('error', function (error) {
59
+ reject(error);
60
+ });
61
+ }));
62
+ case 1:
63
+ case "end":
64
+ return _context2.stop();
65
+ }
66
+ }, _callee2);
67
+ }));
68
+ return function saveUrlToString(_x3) {
69
+ return _ref2.apply(this, arguments);
70
+ };
71
+ }();
72
+ exports.saveUrlToString = saveUrlToString;
73
+ var saveUrlToFile = /*#__PURE__*/function () {
74
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(url, destinationPath) {
75
+ var stream;
76
+ return _regenerator.default.wrap(function _callee3$(_context3) {
77
+ while (1) switch (_context3.prev = _context3.next) {
48
78
  case 0:
49
79
  stream = openDiskFileWriteStream(destinationPath);
50
- _context2.next = 3;
80
+ _context3.next = 3;
51
81
  return saveUrlToStream(url, stream);
52
82
  case 3:
53
83
  stream.close();
54
84
  case 4:
55
85
  case "end":
56
- return _context2.stop();
86
+ return _context3.stop();
57
87
  }
58
- }, _callee2);
88
+ }, _callee3);
59
89
  }));
60
- return function saveUrlToFile(_x3, _x4) {
61
- return _ref2.apply(this, arguments);
90
+ return function saveUrlToFile(_x4, _x5) {
91
+ return _ref3.apply(this, arguments);
62
92
  };
63
93
  }();
64
94
  exports.saveUrlToFile = saveUrlToFile;