@leancodepl/api-binary-blob 9.6.5 → 9.7.0

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 (3) hide show
  1. package/README.md +18 -18
  2. package/index.cjs.js +4 -4
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -41,12 +41,12 @@ Converts ApiBinary to Blob with optional content type.
41
41
  import { fromBlob, toBlob } from "@leancodepl/api-binary-blob"
42
42
 
43
43
  const handleFileUpload = async (file: File) => {
44
- const binary = await fromBlob(file)
44
+ const binary = await fromBlob(file)
45
45
 
46
- await api.post("/upload", {
47
- fileName: file.name,
48
- content: binary,
49
- })
46
+ await api.post("/upload", {
47
+ fileName: file.name,
48
+ content: binary,
49
+ })
50
50
  }
51
51
  ```
52
52
 
@@ -56,15 +56,15 @@ const handleFileUpload = async (file: File) => {
56
56
  import { toBlob } from "@leancodepl/api-binary-blob"
57
57
 
58
58
  const downloadFile = async (binary: ApiBinary, filename: string) => {
59
- const blob = toBlob(binary, "application/octet-stream")
60
- const url = URL.createObjectURL(blob)
59
+ const blob = toBlob(binary, "application/octet-stream")
60
+ const url = URL.createObjectURL(blob)
61
61
 
62
- const link = document.createElement("a")
63
- link.href = url
64
- link.download = filename
65
- link.click()
62
+ const link = document.createElement("a")
63
+ link.href = url
64
+ link.download = filename
65
+ link.click()
66
66
 
67
- URL.revokeObjectURL(url)
67
+ URL.revokeObjectURL(url)
68
68
  }
69
69
  ```
70
70
 
@@ -74,13 +74,13 @@ const downloadFile = async (binary: ApiBinary, filename: string) => {
74
74
  import { fromBlob, toBlob } from "@leancodepl/api-binary-blob"
75
75
 
76
76
  const processImage = async (imageFile: File) => {
77
- const binary = await fromBlob(imageFile)
77
+ const binary = await fromBlob(imageFile)
78
78
 
79
- const processedBlob = toBlob(binary, "image/jpeg")
80
- const preview = URL.createObjectURL(processedBlob)
79
+ const processedBlob = toBlob(binary, "image/jpeg")
80
+ const preview = URL.createObjectURL(processedBlob)
81
81
 
82
- const img = document.createElement("img")
83
- img.src = preview
84
- document.body.appendChild(img)
82
+ const img = document.createElement("img")
83
+ img.src = preview
84
+ document.body.appendChild(img)
85
85
  }
86
86
  ```
package/index.cjs.js CHANGED
@@ -51,8 +51,8 @@ function toBlob(apiBinary$1, contentType) {
51
51
  exports.fromBlob = fromBlob;
52
52
  exports.toBlob = toBlob;
53
53
  Object.keys(apiBinary).forEach(function (k) {
54
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
55
- enumerable: true,
56
- get: function () { return apiBinary[k]; }
57
- });
54
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
55
+ enumerable: true,
56
+ get: function () { return apiBinary[k]; }
57
+ });
58
58
  });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@leancodepl/api-binary-blob",
3
- "version": "9.6.5",
3
+ "version": "9.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "dependencies": {
6
- "@leancodepl/api-binary": "9.6.5"
6
+ "@leancodepl/api-binary": "9.7.0"
7
7
  },
8
8
  "devDependencies": {
9
9
  "blob-polyfill": "^9.0.0"