backblaze 2.3.0 → 2.3.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Francisco Presencia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/index.js CHANGED
@@ -18,7 +18,7 @@ export default function(name, { id = env.B2_ID, key = env.B2_KEY } = {}) {
18
18
  const b2 = new B2({ applicationKeyId: id, applicationKey: key });
19
19
  let bucket = {};
20
20
 
21
- const bucketProm = new Promise(async (done, fail) => {
21
+ const bucketProm = (async () => {
22
22
  try {
23
23
  const auth = await b2.authorize(); // must authorize first
24
24
  const baseURL = auth.data.downloadUrl + "/file/" + name + "/";
@@ -29,12 +29,12 @@ export default function(name, { id = env.B2_ID, key = env.B2_KEY } = {}) {
29
29
  // const raw = list.data.buckets.find(b => b.bucketName === name);
30
30
 
31
31
  bucket = { ...raw, baseURL };
32
- done(bucket);
32
+ return bucket;
33
33
  } catch (error) {
34
34
  console.error("AUTH", error.request ? error.request.res : error);
35
- fail(error);
35
+ throw error;
36
36
  }
37
- });
37
+ })();
38
38
 
39
39
  const info = () => bucketProm;
40
40
 
@@ -101,7 +101,7 @@ export default function(name, { id = env.B2_ID, key = env.B2_KEY } = {}) {
101
101
 
102
102
  // Ignore any leading slash
103
103
  remote = remote.replace(/^\//, "");
104
- const { bucketId } = await info();
104
+ await info();
105
105
  const down = await b2.downloadFileByName({
106
106
  bucketName: name,
107
107
  fileName: remote,
@@ -118,7 +118,7 @@ export default function(name, { id = env.B2_ID, key = env.B2_KEY } = {}) {
118
118
  // Ignore any leading slash
119
119
  remote = remote.replace(/^\//, "");
120
120
  local = local || "./" + remote;
121
- const { bucketId } = await info();
121
+ await info();
122
122
  const down = await b2.downloadFileByName({
123
123
  bucketName: name,
124
124
  fileName: remote,
package/package.json CHANGED
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "name": "backblaze",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "An unofficial package to easily deal with Backblaze B2 API",
5
- "homepage": "https://github.com/franciscop/backblaze#readme",
6
- "repository": "https://github.com/franciscop/backblaze.git",
7
- "bugs": "https://github.com/franciscop/backblaze/issues",
8
- "main": "index.js",
9
- "type": "module",
10
- "scripts": {
11
- "start": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
12
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
13
- },
5
+ "repository": "github:franciscop/backblaze",
6
+ "author": "Francisco Presencia <public@francisco.io> (https://francisco.io/)",
7
+ "funding": "https://www.paypal.me/franciscopresencia/19",
8
+ "license": "MIT",
14
9
  "keywords": [
15
10
  "backblaze",
16
11
  "b2",
@@ -18,19 +13,20 @@
18
13
  "upload",
19
14
  "files"
20
15
  ],
21
- "author": "Francisco Presencia <public@francisco.io> (https://francisco.io/)",
22
- "license": "MIT",
16
+ "scripts": {
17
+ "start": "bun test --watch --timeout 30000",
18
+ "test": "bun test --timeout 30000",
19
+ "lint": "oxlint index.js"
20
+ },
21
+ "main": "index.js",
22
+ "type": "module",
23
+ "files": [],
23
24
  "dependencies": {
24
- "backblaze-b2": "^1.5.0",
25
- "nanoid": "^3.1.9"
25
+ "backblaze-b2": "^1.7.1",
26
+ "nanoid": "^6.0.2"
26
27
  },
27
28
  "devDependencies": {
28
- "dotenv": "^8.2.0",
29
- "jest": "^26.6.3"
30
- },
31
- "files": [],
32
- "jest": {
33
- "transform": {},
34
- "testEnvironment": "jest-environment-node"
29
+ "@types/bun": "^1.4.4",
30
+ "oxlint": "^1.89.0"
35
31
  }
36
32
  }
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # Backblaze [![Status](https://github.com/franciscop/backblaze/workflows/tests/badge.svg)](https://github.com/franciscop/backblaze/actions)
1
+ # Backblaze [![npm install backblaze](https://img.shields.io/badge/npm%20install-backblaze-blue.svg)](https://www.npmjs.com/package/backblaze) [![tests](https://github.com/franciscop/backblaze/workflows/tests/badge.svg)](https://github.com/franciscop/backblaze/actions)
2
2
 
3
3
  An _unofficial_ package to easily deal with Backblaze B2 API on Node.js:
4
4
 
package/changelog.md DELETED
@@ -1,28 +0,0 @@
1
- ## 2.1.0
2
-
3
- - [new feature] Added filter prefix to .list(filter).
4
- - Increased file count for `.list()`.
5
- - Added workflow testing.
6
- - [bug] Allow to limit the key to only current bucket, and it still works.
7
- - [bug] Removed unused Jest
8
-
9
- ### 2.0.2
10
-
11
- Improved documentation on npm.
12
-
13
- ### 2.0.1
14
-
15
- Fixed bug where in some situations `.remove()` would return the filename as a string instead of the full File description.
16
-
17
- ## 2.0.0
18
-
19
- Creted the shared `File` description:
20
-
21
- - [breaking] `.list()`, `.upload()` and `.remove()` now return the new File description.
22
- - `.upload()`, `.download()`, `.exists()` and `remove()` now accept either a plain file name or a File description.
23
-
24
- Added repository info and improved docs.
25
-
26
- ## 1.x.x
27
-
28
- Created the library. It is built on top of `backblaze-b2` but greatly simplifies how to handle everything.