14 Commits

Author SHA1 Message Date
1f6e257cb7 2.0.1 2024-04-17 19:10:22 +02:00
0a79087c59 fix(core): update 2024-04-17 19:10:21 +02:00
432a59bcec 2.0.0 2024-04-17 19:09:56 +02:00
10d7c5d8e8 BREAKING CHANGE(core): switch to uInt8Extras 2024-04-17 19:09:55 +02:00
30306f3a40 update tsconfig 2024-04-14 17:23:03 +02:00
9a4859f6a0 update npmextra.json: githost 2024-04-01 21:33:58 +02:00
099a68d19f update npmextra.json: githost 2024-04-01 19:57:44 +02:00
78576b363e update npmextra.json: githost 2024-03-30 21:46:41 +01:00
066dac4bdc 1.0.7 2024-02-29 22:43:37 +01:00
e1faf34660 fix(core): update 2024-02-29 22:43:37 +01:00
031f6449bd 1.0.6 2024-02-25 01:45:49 +01:00
4f5282e5cd fix(core): update 2024-02-25 01:45:48 +01:00
d42bf699f7 1.0.5 2024-02-25 01:33:16 +01:00
a0d3e8b12f fix(core): update 2024-02-25 01:33:15 +01:00
10 changed files with 225 additions and 324 deletions

View File

@ -2,17 +2,29 @@
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartbuffer",
"description": "handle ArrayBufferLike structures",
"description": "A module for handling ArrayBufferLike structures, including conversion and validation utilities.",
"npmPackagename": "@push.rocks/smartbuffer",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"keywords": [
"typescript",
"arraybuffer",
"buffer conversion",
"base64",
"buffer validation",
"utility",
"data processing"
]
}
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -1,8 +1,8 @@
{
"name": "@push.rocks/smartbuffer",
"version": "1.0.4",
"version": "2.0.1",
"private": false,
"description": "handle ArrayBufferLike structures",
"description": "A module for handling ArrayBufferLike structures, including conversion and validation utilities.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -17,8 +17,8 @@
"@git.zone/tsbundle": "^2.0.5",
"@git.zone/tsrun": "^1.2.46",
"@git.zone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.41"
"@push.rocks/tapbundle": "^5.0.8",
"@types/node": "^20.11.20"
},
"browserslist": [
"last 1 chrome versions"
@ -34,5 +34,17 @@
"cli.js",
"npmextra.json",
"readme.md"
]
],
"keywords": [
"typescript",
"arraybuffer",
"buffer conversion",
"base64",
"buffer validation",
"utility",
"data processing"
],
"dependencies": {
"uint8array-extras": "^1.1.0"
}
}

270
pnpm-lock.yaml generated
View File

@ -4,6 +4,11 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
uint8array-extras:
specifier: ^1.1.0
version: 1.1.0
devDependencies:
'@git.zone/tsbuild':
specifier: ^2.1.25
@ -13,16 +18,16 @@ devDependencies:
version: 2.0.15
'@git.zone/tsrun':
specifier: ^1.2.46
version: 1.2.46(@types/node@17.0.45)
version: 1.2.46(@types/node@20.11.20)
'@git.zone/tstest':
specifier: ^1.0.44
version: 1.0.86(@types/node@17.0.45)(sinon@17.0.1)
'@pushrocks/tapbundle':
specifier: ^5.0.3
version: 5.0.8
version: 1.0.86(@types/node@20.11.20)(sinon@17.0.1)
'@push.rocks/tapbundle':
specifier: ^5.0.8
version: 5.0.15(sinon@17.0.1)
'@types/node':
specifier: ^17.0.41
version: 17.0.45
specifier: ^20.11.20
version: 20.11.20
packages:
@ -341,12 +346,6 @@ packages:
dev: true
optional: true
/@esm-bundle/chai@4.3.4-fix.0:
resolution: {integrity: sha512-26SKdM4uvDWlY8/OOOxSB1AqQWeBosCX3wRYUZO7enTAj03CtVxIiCimYVG2WpULcyV51qapK4qTovwkUr5Mlw==}
dependencies:
'@types/chai': 4.3.12
dev: true
/@git.zone/tsbuild@2.1.72:
resolution: {integrity: sha512-rVWM98chNjkt8pXdF5knGErZjM3GPnRXZYHVGECptxNvvhTol2DliM1OP8k3p3X5UOwEPV2sQVe//XzXs3BcUw==}
hasBin: true
@ -382,13 +381,13 @@ packages:
- supports-color
dev: true
/@git.zone/tsrun@1.2.46(@types/node@17.0.45):
/@git.zone/tsrun@1.2.46(@types/node@20.11.20):
resolution: {integrity: sha512-8miFVBle9Mnjx+uPGI/P+EuWcIOXWjBAkdjN5IYbdp5Ytt4xQODCLh4JSnC9h56UeU1nUxCAxZeJs2e9TXrivA==}
hasBin: true
dependencies:
'@push.rocks/smartfile': 10.0.41
'@push.rocks/smartshell': 3.0.3
ts-node: 10.9.2(@types/node@17.0.45)(typescript@5.1.6)
ts-node: 10.9.2(@types/node@20.11.20)(typescript@5.1.6)
typescript: 5.1.6
transitivePeerDependencies:
- '@swc/core'
@ -396,13 +395,13 @@ packages:
- '@types/node'
dev: true
/@git.zone/tstest@1.0.86(@types/node@17.0.45)(sinon@17.0.1):
/@git.zone/tstest@1.0.86(@types/node@20.11.20)(sinon@17.0.1):
resolution: {integrity: sha512-ec95MNeA21L+ob+lvLVCmwPTTC1BY+v/JHLYZ9DOZ9+9buLgx+cJ7VkwGBJCnlWJtqEtJosUrFKTih36iNuT3g==}
hasBin: true
dependencies:
'@api.global/typedserver': 3.0.24
'@git.zone/tsbundle': 2.0.15
'@git.zone/tsrun': 1.2.46(@types/node@17.0.45)
'@git.zone/tsrun': 1.2.46(@types/node@20.11.20)
'@push.rocks/consolecolor': 2.0.1
'@push.rocks/smartbrowser': 2.0.6
'@push.rocks/smartdelay': 3.0.5
@ -506,13 +505,6 @@ packages:
lit-html: 1.4.1
dev: true
/@open-wc/scoped-elements@2.2.4:
resolution: {integrity: sha512-12X4F4QGPWcvPbxAiJ4v8wQFCOu+laZHRGfTrkoj+3JzACCtuxHG49YbuqVzQ135QPKCuhP9wA0kpGGEfUegyg==}
dependencies:
'@lit/reactive-element': 2.0.4
'@open-wc/dedupe-mixin': 1.4.0
dev: true
/@open-wc/semantic-dom-diff@0.13.21:
resolution: {integrity: sha512-BONpjHcGX2zFa9mfnwBCLEmlDsOHzT+j6Qt1yfK3MzFXFtAykfzFjAgaxPetu0YbBlCfXuMlfxI4vlRGCGMvFg==}
dev: true
@ -528,17 +520,6 @@ packages:
- utf-8-validate
dev: true
/@open-wc/semantic-dom-diff@0.20.1:
resolution: {integrity: sha512-mPF/RPT2TU7Dw41LEDdaeP6eyTOWBD4z0+AHP4/d0SbgcfJZVRymlIB6DQmtz0fd2CImIS9kszaMmwMt92HBPA==}
dependencies:
'@types/chai': 4.3.12
'@web/test-runner-commands': 0.9.0
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
dev: true
/@open-wc/testing-helpers@1.8.12:
resolution: {integrity: sha512-+4exEHYvnFqI1RGDDIKFHPZ7Ws5NK1epvEku3zLaOYN3zc+huX19SndNc5+X++v8A+quN/iXbHlh80ROyNaYDA==}
dependencies:
@ -547,14 +528,6 @@ packages:
lit-html: 1.4.1
dev: true
/@open-wc/testing-helpers@2.3.2:
resolution: {integrity: sha512-uZMGC/C1m5EiwQsff6KMmCW25TYMQlJt4ilAWIjnelWGFg9HPUiLnlFvAas3ESUP+4OXLO8Oft7p4mHvbYvAEQ==}
dependencies:
'@open-wc/scoped-elements': 2.2.4
lit: 3.1.2
lit-html: 3.1.2
dev: true
/@open-wc/testing@2.5.33(sinon@17.0.1):
resolution: {integrity: sha512-+EJNs0i+VV4nE+BrG70l2DNGXOZTSrluruaaU06HUSk57ZlKa+kIxWmkLxCOLlbgnQgrPrQWxbs3lgB1tIx/YA==}
dependencies:
@ -577,21 +550,6 @@ packages:
- utf-8-validate
dev: true
/@open-wc/testing@3.2.2:
resolution: {integrity: sha512-byN4dJTd6ZyI9mWmI4lVj30uiu+rYvQr93g64Pd7UFBdAUgb02DHLj6fkJ1gjxA6LC/MeFd7K7mOZ4+vKrMptw==}
dependencies:
'@esm-bundle/chai': 4.3.4-fix.0
'@open-wc/semantic-dom-diff': 0.20.1
'@open-wc/testing-helpers': 2.3.2
'@types/chai-dom': 1.11.3
'@types/sinon-chai': 3.2.12
chai-a11y-axe: 1.5.0
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
dev: true
/@pkgjs/parseargs@0.11.0:
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
@ -1159,15 +1117,6 @@ packages:
'@pushrocks/smartdelay': 2.0.13
dev: true
/@pushrocks/smartexpect@1.0.15:
resolution: {integrity: sha512-ABhsgmTqE1cfL6m0qpicZf6FdfuUip3oJR8CDr9wZwkBODKpahv7lHqeN0EjdvaJuHyqqcd3m1WaHmLPEyZ63A==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smartexpect
dependencies:
'@pushrocks/smartdelay': 3.0.1
'@pushrocks/smartpromise': 4.0.2
fast-deep-equal: 3.1.3
dev: true
/@pushrocks/smarthash@3.0.2:
resolution: {integrity: sha512-jXW4f8k6iqOQRvkCmXMID1C+qXyNvUMKm7apPETxnO+L172VlzxP1dml0Ey1+vjfpU2luKCteJWX7W95sOdLDg==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/smarthash
@ -1305,23 +1254,6 @@ packages:
pretty-ms: 8.0.0
dev: true
/@pushrocks/tapbundle@5.0.8:
resolution: {integrity: sha512-w6oyVA1VYht5/OnUrWrvdDqBpb3H5ao3LATKauTG9wSyOng65/8ttAbhHqg5Jo39Hlib9QYbLH3QQyLfukfxCw==}
deprecated: This package has been deprecated in favour of the new package at @push.rocks/tapbundle
dependencies:
'@open-wc/testing': 3.2.2
'@open-wc/testing-helpers': 2.3.2
'@pushrocks/smartdelay': 3.0.1
'@pushrocks/smartenv': 5.0.5
'@pushrocks/smartexpect': 1.0.15
'@pushrocks/smartpromise': 4.0.2
'@pushrocks/smarttime': 4.0.1
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
dev: true
/@rkusa/linebreak@1.0.0:
resolution: {integrity: sha512-yCSm87XA1aYMgfcABSxcIkk3JtCw3AihNceHY+DnZGLvVP/g2z3UWZbi0xIoYpZWAJEVPr5Zt3QE37Q80wF1pA==}
dependencies:
@ -1411,7 +1343,7 @@ packages:
/@types/accepts@1.3.7:
resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/babel__code-frame@7.0.6:
@ -1422,7 +1354,7 @@ packages:
resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==}
dependencies:
'@types/connect': 3.4.38
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/buffer-json@2.0.3:
@ -1435,12 +1367,6 @@ packages:
'@types/chai': 4.3.12
dev: true
/@types/chai-dom@1.11.3:
resolution: {integrity: sha512-EUEZI7uID4ewzxnU7DJXtyvykhQuwe+etJ1wwOiJyQRTH/ifMWKX+ghiXkxCUvNJ6IQDodf0JXhuP6zZcy2qXQ==}
dependencies:
'@types/chai': 4.3.12
dev: true
/@types/chai@4.3.12:
resolution: {integrity: sha512-zNKDHG/1yxm8Il6uCCVsm+dRdEsJlFoDu73X17y09bId6UwoYww+vFBsAcRzl8knM1sab3Dp1VRikFQwDOtDDw==}
dev: true
@ -1448,21 +1374,21 @@ packages:
/@types/clean-css@4.2.11:
resolution: {integrity: sha512-Y8n81lQVTAfP2TOdtJJEsCoYl1AnOkqDqMvXb9/7pfgZZ7r8YrEyurrAvAoAjHOGXKRybay+5CsExqIH6liccw==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
source-map: 0.6.1
dev: true
/@types/co-body@6.1.3:
resolution: {integrity: sha512-UhuhrQ5hclX6UJctv5m4Rfp52AfG9o9+d9/HwjxhVB5NjXxr5t9oKgJxN8xRHgr35oo8meUEHUPFWiKg6y71aA==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
'@types/qs': 6.9.11
dev: true
/@types/connect@3.4.38:
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/content-disposition@0.5.8:
@ -1483,13 +1409,13 @@ packages:
'@types/connect': 3.4.38
'@types/express': 4.17.21
'@types/keygrip': 1.0.6
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/cors@2.8.17:
resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/debounce@1.2.4:
@ -1503,7 +1429,7 @@ packages:
/@types/express-serve-static-core@4.17.43:
resolution: {integrity: sha512-oaYtiBirUOPQGSWNGPWnzyAFJ0BP3cwvN4oWZQY+zUBwpVIGsKUkpBpSztp74drYcjavs7SKFZ4DX1V2QeN8rg==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
'@types/qs': 6.9.11
'@types/range-parser': 1.2.7
'@types/send': 0.17.4
@ -1521,21 +1447,21 @@ packages:
/@types/from2@2.3.5:
resolution: {integrity: sha512-giavnjf3kNlJnE+HpZA1CQ3UKHxgehzsTuIMGda8pGMbOiLYGVNADEskey44OZcADHm/HOoBany8IV+0x28XFw==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/fs-extra@11.0.4:
resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==}
dependencies:
'@types/jsonfile': 6.1.4
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/glob@8.1.0:
resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==}
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/html-minifier@4.0.5:
@ -1585,7 +1511,7 @@ packages:
/@types/jsonfile@6.1.4:
resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/keygrip@1.0.6:
@ -1608,7 +1534,7 @@ packages:
'@types/http-errors': 2.0.4
'@types/keygrip': 1.0.6
'@types/koa-compose': 3.2.8
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/mime-types@2.1.4:
@ -1635,8 +1561,10 @@ packages:
resolution: {integrity: sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==}
dev: true
/@types/node@17.0.45:
resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==}
/@types/node@20.11.20:
resolution: {integrity: sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==}
dependencies:
undici-types: 5.26.5
dev: true
/@types/parse5@6.0.3:
@ -1667,7 +1595,7 @@ packages:
resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==}
dependencies:
'@types/mime': 1.3.5
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/serve-static@1.15.5:
@ -1675,7 +1603,7 @@ packages:
dependencies:
'@types/http-errors': 2.0.4
'@types/mime': 3.0.4
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/sinon-chai@3.2.12:
@ -1702,7 +1630,7 @@ packages:
/@types/through2@2.0.41:
resolution: {integrity: sha512-ryQ0tidWkb1O1JuYvWKyMLYEtOWDqF5mHerJzKz/gQpoAaJq2l/dsMPBF0B5BNVT34rbARYJ5/tsZwLfUi2kwQ==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/trusted-types@2.0.7:
@ -1730,20 +1658,20 @@ packages:
/@types/ws@7.4.7:
resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/ws@8.5.10:
resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==}
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
/@types/yauzl@2.10.3:
resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==}
requiresBuild: true
dependencies:
'@types/node': 17.0.45
'@types/node': 20.11.20
dev: true
optional: true
@ -1754,13 +1682,6 @@ packages:
errorstacks: 2.4.1
dev: true
/@web/browser-logs@0.4.0:
resolution: {integrity: sha512-/EBiDAUCJ2DzZhaFxTPRIznEPeafdLbXShIL6aTu7x73x7ZoxSDv7DGuTsh2rWNMUa4+AKli4UORrpyv6QBOiA==}
engines: {node: '>=18.0.0'}
dependencies:
errorstacks: 2.4.1
dev: true
/@web/dev-server-core@0.4.1:
resolution: {integrity: sha512-KdYwejXZwIZvb6tYMCqU7yBiEOPfKLQ3V9ezqqEz8DA9V9R3oQWaowckvCpFB9IxxPfS/P8/59OkdzGKQjcIUw==}
engines: {node: '>=10.0.0'}
@ -1789,34 +1710,6 @@ packages:
- utf-8-validate
dev: true
/@web/dev-server-core@0.7.1:
resolution: {integrity: sha512-alHd2j0f4e1ekqYDR8lWScrzR7D5gfsUZq3BP3De9bkFWM3AELINCmqqlVKmCtlkAdEc9VyQvNiEqrxraOdc2A==}
engines: {node: '>=18.0.0'}
dependencies:
'@types/koa': 2.15.0
'@types/ws': 7.4.7
'@web/parse5-utils': 2.1.0
chokidar: 3.6.0
clone: 2.1.2
es-module-lexer: 1.4.1
get-stream: 6.0.1
is-stream: 2.0.1
isbinaryfile: 5.0.2
koa: 2.15.0
koa-etag: 4.0.0
koa-send: 5.0.1
koa-static: 5.0.0
lru-cache: 8.0.5
mime-types: 2.1.35
parse5: 6.0.1
picomatch: 2.3.1
ws: 7.5.9
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
dev: true
/@web/parse5-utils@1.3.1:
resolution: {integrity: sha512-haCgDchZrAOB9EhBJ5XqiIjBMsS/exsM5Ru7sCSyNkXVEJWskyyKuKMFk66BonnIGMPpDtqDrTUfYEis5Zi3XA==}
engines: {node: '>=10.0.0'}
@ -1825,14 +1718,6 @@ packages:
parse5: 6.0.1
dev: true
/@web/parse5-utils@2.1.0:
resolution: {integrity: sha512-GzfK5disEJ6wEjoPwx8AVNwUe9gYIiwc+x//QYxYDAFKUp4Xb1OJAGLc2l2gVrSQmtPGLKrTRcW90Hv4pEq1qA==}
engines: {node: '>=18.0.0'}
dependencies:
'@types/parse5': 6.0.3
parse5: 6.0.1
dev: true
/@web/test-runner-commands@0.6.6:
resolution: {integrity: sha512-2DcK/+7f8QTicQpGFq/TmvKHDK/6Zald6rn1zqRlmj3pcH8fX6KHNVMU60Za9QgAKdorMBPfd8dJwWba5otzdw==}
engines: {node: '>=12.0.0'}
@ -1845,18 +1730,6 @@ packages:
- utf-8-validate
dev: true
/@web/test-runner-commands@0.9.0:
resolution: {integrity: sha512-zeLI6QdH0jzzJMDV5O42Pd8WLJtYqovgdt0JdytgHc0d1EpzXDsc7NTCJSImboc2NcayIsWAvvGGeRF69SMMYg==}
engines: {node: '>=18.0.0'}
dependencies:
'@web/test-runner-core': 0.13.1
mkdirp: 1.0.4
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
dev: true
/@web/test-runner-core@0.10.29:
resolution: {integrity: sha512-0/ZALYaycEWswHhpyvl5yqo0uIfCmZe8q14nGPi1dMmNiqLcHjyFGnuIiLexI224AW74ljHcHllmDlXK9FUKGA==}
engines: {node: '>=12.0.0'}
@ -1893,42 +1766,6 @@ packages:
- utf-8-validate
dev: true
/@web/test-runner-core@0.13.1:
resolution: {integrity: sha512-2hESALx/UFsAzK+ApWXAkFp2eCmwcs2yj1v4YjwV8F38sQumJ40P3px3BMjFwkOYDORtQOicW0RUeSw1g3BMLA==}
engines: {node: '>=18.0.0'}
dependencies:
'@babel/code-frame': 7.23.5
'@types/babel__code-frame': 7.0.6
'@types/co-body': 6.1.3
'@types/convert-source-map': 2.0.3
'@types/debounce': 1.2.4
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
'@web/browser-logs': 0.4.0
'@web/dev-server-core': 0.7.1
chokidar: 3.6.0
cli-cursor: 3.1.0
co-body: 6.1.0
convert-source-map: 2.0.0
debounce: 1.2.1
dependency-graph: 0.11.0
globby: 11.1.0
ip: 2.0.1
istanbul-lib-coverage: 3.2.2
istanbul-lib-report: 3.0.1
istanbul-reports: 3.1.7
log-update: 4.0.0
nanocolors: 0.2.13
nanoid: 3.3.7
open: 8.4.2
picomatch: 2.3.1
source-map: 0.7.4
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
dev: true
/@xmldom/xmldom@0.8.10:
resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==}
engines: {node: '>=10.0.0'}
@ -2569,7 +2406,7 @@ packages:
supports-color:
optional: true
dependencies:
ms: 2.1.1
ms: 2.1.3
supports-color: 6.0.0
dev: true
@ -2778,7 +2615,7 @@ packages:
dependencies:
'@types/cookie': 0.4.1
'@types/cors': 2.8.17
'@types/node': 17.0.45
'@types/node': 20.11.20
accepts: 1.3.8
base64id: 2.0.0
cookie: 0.4.2
@ -3275,7 +3112,7 @@ packages:
fs.realpath: 1.0.0
inflight: 1.0.6
inherits: 2.0.4
minimatch: 3.0.4
minimatch: 3.1.2
once: 1.4.0
path-is-absolute: 1.0.1
dev: true
@ -3540,10 +3377,6 @@ packages:
resolution: {integrity: sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==}
dev: true
/ip@2.0.1:
resolution: {integrity: sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==}
dev: true
/ipaddr.js@1.9.1:
resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
engines: {node: '>= 0.10'}
@ -4085,11 +3918,6 @@ packages:
yallist: 4.0.0
dev: true
/lru-cache@8.0.5:
resolution: {integrity: sha512-MhWWlVnuab1RG5/zMRRcVGXZLCXrZTgfwMikgzCegsPnG62yDQo5JnqKkrK4jO5iKqDAZGItAqN5CtKBCBWRUA==}
engines: {node: '>=16.14'}
dev: true
/make-dir@3.1.0:
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
engines: {node: '>=8'}
@ -5360,7 +5188,6 @@ packages:
/tiny-worker@2.3.0:
resolution: {integrity: sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==}
requiresBuild: true
dependencies:
esm: 3.2.25
dev: true
@ -5393,7 +5220,7 @@ packages:
hasBin: true
dev: true
/ts-node@10.9.2(@types/node@17.0.45)(typescript@5.1.6):
/ts-node@10.9.2(@types/node@20.11.20)(typescript@5.1.6):
resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
hasBin: true
peerDependencies:
@ -5412,7 +5239,7 @@ packages:
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 17.0.45
'@types/node': 20.11.20
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
@ -5537,6 +5364,11 @@ packages:
hasBin: true
dev: true
/uint8array-extras@1.1.0:
resolution: {integrity: sha512-CVaBSyOmGoFHu+zOVPbetXEXykOd8KHVBHLlqvmaMWpwcq3rewj18xVNbU5uzf48hclnNQhfNaNany2cMHFK/g==}
engines: {node: '>=18'}
dev: false
/unbox-primitive@1.0.2:
resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==}
dependencies:
@ -5553,6 +5385,10 @@ packages:
through: 2.3.8
dev: true
/undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
dev: true
/unicode-trie@0.3.1:
resolution: {integrity: sha1-1nHd3YkQGgi6w3tqUWEBBgIFIIU=}
dependencies:

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

120
readme.md
View File

@ -1,39 +1,105 @@
# @pushrocks/smartbuffer
# @push.rocks/smartbuffer
handle ArrayBufferLike structures
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartbuffer)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartbuffer)
* [github.com (source mirror)](https://github.com/pushrocks/smartbuffer)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartbuffer/)
## Install
## Status for master
To install `@push.rocks/smartbuffer`, use the following command with npm:
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartbuffer/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartbuffer/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartbuffer)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartbuffer)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartbuffer)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartbuffer)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartbuffer)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
```sh
npm install @push.rocks/smartbuffer --save
```
or with yarn:
```sh
yarn add @push.rocks/smartbuffer
```
This will add `@push.rocks/smartbuffer` to your project's dependencies and you'll be ready to use it in your application.
## Usage
use TypeScript for best in class intellisense
`@push.rocks/smartbuffer` is designed to make handling `ArrayBufferLike` structures easier and more intuitive, specifically in TypeScript and in environments that support ECMAScript modules. This includes web browsers, Node.js (with ESM support enabled), and Deno.
## Contribution
### Basic Concepts
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
Before diving into the usage examples, lets clarify what `ArrayBufferLike` structures are. In JavaScript, the `ArrayBuffer` object is used to represent a generic, fixed-length raw binary data buffer. An `ArrayBufferLike` is any data structure that can be viewed as representing such binary data. The `Buffer` class in Node.js and `Uint8Array` are typical examples of `ArrayBufferLike` structures.
For further information read the linked docs at the top of this readme.
### Importing the Module
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
First, import the functions you need from the module:
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
```typescript
import { arrayBufferToBase64, base64ToArrayBuffer, isBufferLike } from '@push.rocks/smartbuffer';
```
### Converting `ArrayBuffer` to Base64 String
Often, youll need to convert binary data represented by an `ArrayBuffer` into a Base64 encoded string. This is especially common when you need to transmit binary data over a medium that only supports text content, such as JSON.
```typescript
const myArrayBuffer = new ArrayBuffer(8);
const view = new Uint8Array(myArrayBuffer);
// Fill the buffer with some data
view.set([8, 6, 7, 5, 3, 0, 9]);
const base64String = arrayBufferToBase64(myArrayBuffer);
console.log(base64String); // Output will be a Base64 encoded string of the ArrayBuffer content
```
### Converting a Base64 String to `ArrayBuffer`
Conversely, if you have a Base64 encoded string that represents binary data, you can convert it back to an `ArrayBuffer` or a `Uint8Array` for further manipulation or use within your application.
```typescript
const base64String = "aGVsbG8gd29ybGQ="; // "hello world" in Base64
const arrayBuffer = base64ToArrayBuffer(base64String);
console.log(new TextDecoder().decode(arrayBuffer)); // Expects to output "hello world"
```
### Checking if an Object is `ArrayBufferLike`
Sometimes you may need to validate whether a given object is an `ArrayBufferLike` structure (`ArrayBuffer`, `Uint8Array`, `Buffer`, etc.). This is useful in functions that are meant to operate on binary data and need to ensure the data passed to them is in the correct format.
```typescript
const buffer = new Uint8Array([1, 2, 3, 4]);
const notBuffer = [1, 2, 3, 4];
console.log(isBufferLike(buffer)); // true
console.log(isBufferLike(notBuffer)); // false
```
### Practical Applications
The functionality provided by `@push.rocks/smartbuffer` is particularly helpful in applications dealing with file operations, network communications, or any context where binary data needs to be processed, transformed, or transmitted.
For instance, when receiving files as part of a web API, converting these files to Base64 strings for storage or transmission is a common requirement. Similarly, when working with WebSockets or server-sent events, `ArrayBuffer` objects and their views (`Uint8Array`, etc.) are commonly used to handle binary data efficiently.
By providing utilities to convert between binary data and Base64 strings, as well as methods to check data types, `@push.rocks/smartbuffer` simplifies the implementation of complex data handling operations. Whether you are working with IoT devices, implementing a web application that manipulates images or audio files, or dealing with any form of binary data, `@push.rocks/smartbuffer` is a valuable tool to have in your toolkit.
Remember to thoroughly test your applications to ensure that data integrity is maintained throughout all operations involving `ArrayBufferLike` structures.
---
The provided examples cover the core features of `@push.rocks/smartbuffer`. For advanced use cases, refer to the module's documentation and explore the source code to better understand its capabilities and how it can be integrated into your specific projects.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

21
test/test.both.ts Normal file
View File

@ -0,0 +1,21 @@
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as smartbuffer from '../ts/index.js';
tap.test('first test', async () => {
console.log(smartbuffer);
});
tap.test('should recognize different buffer like objects', async () => {
// const testBuffer = Buffer.from('test');
const testArrayBuffer = new ArrayBuffer(4);
const testUint8Array = new Uint8Array(testArrayBuffer);
testUint8Array[0] = 116;
testUint8Array[1] = 101;
testUint8Array[2] = 115;
testUint8Array[3] = 116;
// expect(smartbuffer.isBufferLike(testBuffer)).toBeTrue();
expect(smartbuffer.isBufferLike(testArrayBuffer)).toBeTrue();
expect(smartbuffer.isBufferLike(testUint8Array)).toBeTrue();
});
tap.start();

View File

@ -1,8 +0,0 @@
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartbuffer from '../ts/index.js';
tap.test('first test', async () => {
console.log(smartbuffer);
});
tap.start();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartbuffer',
version: '1.0.4',
description: 'handle ArrayBufferLike structures'
version: '2.0.1',
description: 'A module for handling ArrayBufferLike structures, including conversion and validation utilities.'
}

View File

@ -1,67 +1,25 @@
import * as plugins from './smartbuffer.plugins.js';
export function arrayBufferToBase64(arrayBuffer: ArrayBufferLike | Buffer): string {
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
export const uInt8ArrayExtras = plugins.uInt8ArrayExtras;
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
var byteRemainder = byteLength % 3
var mainLength = byteLength - byteRemainder
var a, b, c, d
var chunk
// Main loop deals with bytes in chunks of 3
for (var i = 0; i < mainLength; i = i + 3) {
// Combine the three bytes into a single integer
chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]
// Use bitmasks to extract 6-bit segments from the triplet
a = (chunk & 16515072) >> 18 // 16515072 = (2^6 - 1) << 18
b = (chunk & 258048) >> 12 // 258048 = (2^6 - 1) << 12
c = (chunk & 4032) >> 6 // 4032 = (2^6 - 1) << 6
d = chunk & 63 // 63 = 2^6 - 1
// Convert the raw binary segments to the appropriate ASCII encoding
base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]
export function uInt8ArrayToBase64(uInt8Array: Uint8Array): string {
return plugins.uInt8ArrayExtras.uint8ArrayToBase64(uInt8Array);
}
// Deal with the remaining bytes and padding
if (byteRemainder == 1) {
chunk = bytes[mainLength]
a = (chunk & 252) >> 2 // 252 = (2^6 - 1) << 2
// Set the 4 least significant bits to zero
b = (chunk & 3) << 4 // 3 = 2^2 - 1
base64 += encodings[a] + encodings[b] + '=='
} else if (byteRemainder == 2) {
chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1]
a = (chunk & 64512) >> 10 // 64512 = (2^6 - 1) << 10
b = (chunk & 1008) >> 4 // 1008 = (2^6 - 1) << 4
// Set the 2 least significant bits to zero
c = (chunk & 15) << 2 // 15 = 2^4 - 1
base64 += encodings[a] + encodings[b] + encodings[c] + '='
export function base64ToUint8Array(base64: string): Uint8Array {
return plugins.uInt8ArrayExtras.base64ToUint8Array(base64);
}
return base64
export function isBufferLike(obj: any): obj is ArrayBufferLike | Buffer {
// Check for ArrayBufferLike objects in any environment
if (obj && typeof obj.byteLength === 'number') {
return true;
}
export function base64ToArrayBuffer(base64: string): Uint8Array {
const binaryString = window.atob(base64);
const arrayLength = binaryString.length;
const arrayBuffer = new Uint8Array( arrayLength );
for (var i = 0; i < arrayLength; i++) {
arrayBuffer[i] = binaryString.charCodeAt(i);
}
return arrayBuffer;
// Additional check specific to Node.js environment for Buffer objects
if (typeof Buffer !== 'undefined' && Buffer.isBuffer) {
return Buffer.isBuffer(obj);
}
export function isArrayBufferLike(obj: any): obj is ArrayBufferLike {
return obj && typeof obj.byteLength === 'number';
return false;
}

View File

@ -1,2 +1,5 @@
const removeme = {};
export { removeme };
import * as uInt8ArrayExtras from 'uint8array-extras';
export {
uInt8ArrayExtras,
}