b2-cloud-storage 1.0.2 → 1.0.5

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.
Files changed (4) hide show
  1. package/README.md +54 -55
  2. package/docs.md +2 -1
  3. package/index.js +1649 -1617
  4. package/package.json +57 -56
package/README.md CHANGED
@@ -1,56 +1,55 @@
1
- # b2-cloud-storage
2
- [![npm version](https://badge.fury.io/js/b2-cloud-storage.svg)](https://badge.fury.io/js/b2-cloud-storage)
3
- [![dependencies Status](https://david-dm.org/nodecraft/b2-cloud-storage/status.svg)](https://david-dm.org/nodecraft/b2-cloud-storage)
4
- [![Greenkeeper badge](https://badges.greenkeeper.io/nodecraft/b2-cloud-storage.svg)](https://greenkeeper.io/)
5
- [![Actions Status](https://github.com/nodecraft/b2-cloud-storage/workflows/Test/badge.svg)](https://github.com/nodecraft/b2-cloud-storage/actions)
6
- [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnodecraft%2Fb2-cloud-storage.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnodecraft%2Fb2-cloud-storage?ref=badge_shield)
7
-
8
- Backblaze B2 Cloud Storage API Client
9
-
10
- `b2-cloud-storage` is an API wrapper for all current [Backblaze B2 API](https://www.backblaze.com/b2/docs/) operations. It provides helper methods for uploading files of all sizes, and takes care of the necessary chunking, parting, and API retries that need to happen to ensure files are uploaded successfully.
11
-
12
- This module adheres the integration guidelines as published by Backblaze at https://www.backblaze.com/b2/docs/integration_checklist.html.
13
-
14
- ## Basic Example
15
-
16
- ```javascript
17
- 'use strict';
18
- const b2CloudStorage = require('b2-cloud-storage');
19
-
20
- const b2 = new b2CloudStorage({
21
- auth: {
22
- accountId: '<accountId>', // NOTE: This is the accountId unique to the key
23
- applicationKey: '<applicationKey>'
24
- }
25
- });
26
-
27
- b2.authorize(function(err){
28
- if(err){ throw err; }
29
-
30
- // this function wraps both a normal upload AND a large file upload
31
- b2.uploadFile('/path/to/file.zip', {
32
- bucketId: '<bucketId>',
33
- fileName: 'file.zip', // this is the object storage "key". Can include a full path
34
- contentType: 'application/zip',
35
- onUploadProgress: function(update){
36
- console.log(`Progress: ${update.percent}% (${update.bytesDispatched}/${update.bytesTotal}`);
37
- // output: Progress: 9% 9012/100024
38
- }
39
- }, function(err, results){
40
- // handle callback
41
- });
42
- });
43
- ```
44
-
45
-
46
- ## Documentation
47
- You can read the [full documentation here](docs.md).
48
-
49
- ## Roadmap:
50
- - [ ] Improve unit tests and code coverage
51
- - [ ] Add helper methods to delete all file versions for a single file
52
- - [ ] Add helper methods to better query paginated search
53
-
54
-
55
- ## License
1
+ # b2-cloud-storage
2
+ [![npm version](https://badge.fury.io/js/b2-cloud-storage.svg)](https://badge.fury.io/js/b2-cloud-storage)
3
+ [![dependencies Status](https://david-dm.org/nodecraft/b2-cloud-storage/status.svg)](https://david-dm.org/nodecraft/b2-cloud-storage)
4
+ [![Actions Status](https://github.com/nodecraft/b2-cloud-storage/workflows/Test/badge.svg)](https://github.com/nodecraft/b2-cloud-storage/actions)
5
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnodecraft%2Fb2-cloud-storage.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnodecraft%2Fb2-cloud-storage?ref=badge_shield)
6
+
7
+ Backblaze B2 Cloud Storage API Client
8
+
9
+ `b2-cloud-storage` is an API wrapper for all current [Backblaze B2 API](https://www.backblaze.com/b2/docs/) operations. It provides helper methods for uploading files of all sizes, and takes care of the necessary chunking, parting, and API retries that need to happen to ensure files are uploaded successfully.
10
+
11
+ This module adheres the integration guidelines as published by Backblaze at https://www.backblaze.com/b2/docs/integration_checklist.html.
12
+
13
+ ## Basic Example
14
+
15
+ ```javascript
16
+ 'use strict';
17
+ const b2CloudStorage = require('b2-cloud-storage');
18
+
19
+ const b2 = new b2CloudStorage({
20
+ auth: {
21
+ accountId: '<accountId>', // NOTE: This is the accountId unique to the key
22
+ applicationKey: '<applicationKey>'
23
+ }
24
+ });
25
+
26
+ b2.authorize(function(err){
27
+ if(err){ throw err; }
28
+
29
+ // this function wraps both a normal upload AND a large file upload
30
+ b2.uploadFile('/path/to/file.zip', {
31
+ bucketId: '<bucketId>',
32
+ fileName: 'file.zip', // this is the object storage "key". Can include a full path
33
+ contentType: 'application/zip',
34
+ onUploadProgress: function(update){
35
+ console.log(`Progress: ${update.percent}% (${update.bytesDispatched}/${update.bytesTotal}`);
36
+ // output: Progress: 9% 9012/100024
37
+ }
38
+ }, function(err, results){
39
+ // handle callback
40
+ });
41
+ });
42
+ ```
43
+
44
+
45
+ ## Documentation
46
+ You can read the [full documentation here](docs.md).
47
+
48
+ ## Roadmap:
49
+ - [ ] Improve unit tests and code coverage
50
+ - [ ] Add helper methods to delete all file versions for a single file
51
+ - [ ] Add helper methods to better query paginated search
52
+
53
+
54
+ ## License
56
55
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnodecraft%2Fb2-cloud-storage.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnodecraft%2Fb2-cloud-storage?ref=badge_large)
package/docs.md CHANGED
@@ -69,7 +69,8 @@ Creates new instance of the b2CloudStorage class.
69
69
  <a name="b2CloudStorage+uploadFile"></a>
70
70
 
71
71
  ### b2CloudStorage.uploadFile(filename, data, [callback]) ⇒ <code>object</code>
72
- Upload file with `b2_upload_file` or as several parts of a large file upload.
72
+ Upload file with `b2_upload_file` or as several parts of a large file upload.
73
+ This method also will get the filesize & sha1 hash of the entire file.
73
74
 
74
75
  **Kind**: instance method of [<code>b2CloudStorage</code>](#b2CloudStorage)
75
76
  **Returns**: <code>object</code> - Returns an object with 3 helper methods: `cancel()`, `progress()`, & `info()`