Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
1c80a1097b | |||
4344dbd111 | |||
bb89564339 | |||
f480be9917 | |||
11bf0d9dbb | |||
c58cc2b0df | |||
87273cbbbd |
139
.gitlab-ci.yml
139
.gitlab-ci.yml
@ -1,139 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- npm install -g @shipzone/npmci
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
auditDevDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=dev
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run buildDocs
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
80
changelog.md
Normal file
80
changelog.md
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-04-12 - 3.0.5 - fix(documentation)
|
||||||
|
Enhance documentation with extensive usage examples, update project metadata, and remove obsolete CI configuration
|
||||||
|
|
||||||
|
- Updated package description and keywords in package.json and npmextra.json to better reflect the library's robust binary data handling capabilities
|
||||||
|
- Revised README with comprehensive guides, detailed code examples, and advanced use cases for conversions, validations, and integrations
|
||||||
|
- Removed outdated .gitlab-ci.yml file to streamline CI configuration
|
||||||
|
- Improved clarity and structure in documentation for both browser and Node.js environments
|
||||||
|
|
||||||
|
## 2024-05-29 - 3.0.4 - misc
|
||||||
|
Updated project description.
|
||||||
|
- Updated the project description to better reflect current features.
|
||||||
|
|
||||||
|
## 2024-04-25 - 3.0.3 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-04-25 - 3.0.2 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-04-17 - 3.0.1 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-04-17 - 3.0.0 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-04-17 - 2.0.3 - core
|
||||||
|
Breaking change in core module.
|
||||||
|
- BREAKING CHANGE (core): Updated core functionality.
|
||||||
|
|
||||||
|
## 2024-04-17 - 2.0.2 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-04-17 - 2.0.1 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-04-17 - 2.0.0 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-04-17 - 1.0.7 - core, config
|
||||||
|
Multiple updates including breaking changes and configuration adjustments.
|
||||||
|
- BREAKING CHANGE (core): Switched to uInt8Extras.
|
||||||
|
- Updated tsconfig.
|
||||||
|
- Updated npmextra.json for githost.
|
||||||
|
|
||||||
|
## 2024-02-29 - 1.0.6 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-02-25 - 1.0.5 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-02-25 - 1.0.4 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2024-02-25 - 1.0.3 - core, org
|
||||||
|
Core fixes and organizational change.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
- Switched to new organization scheme.
|
||||||
|
|
||||||
|
## 2022-06-15 - 1.0.2 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
## 2022-06-15 - 1.0.1 - core
|
||||||
|
Core fixes applied.
|
||||||
|
- Fixed issues in the core module.
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Note: Routine version bump commits that only updated the version numbers have been omitted for clarity.
|
||||||
|
-->
|
@ -5,21 +5,21 @@
|
|||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartbuffer",
|
"gitrepo": "smartbuffer",
|
||||||
"description": "A library for managing ArrayBufferLike structures including conversion between Base64 and Uint8Array, and buffer validation.",
|
"description": "A robust TypeScript library for managing binary data by converting between Base64 strings and Uint8Array, validating buffer-like objects, and ensuring data purity.",
|
||||||
"npmPackagename": "@push.rocks/smartbuffer",
|
"npmPackagename": "@push.rocks/smartbuffer",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "push.rocks",
|
"projectDomain": "push.rocks",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ArrayBuffer",
|
"ArrayBuffer",
|
||||||
"TypeScript",
|
|
||||||
"base64 conversion",
|
|
||||||
"Uint8Array",
|
"Uint8Array",
|
||||||
"data transformation",
|
"base64 conversion",
|
||||||
"binary data handling",
|
"binary data handling",
|
||||||
"buffer validation",
|
"buffer validation",
|
||||||
"modular programming",
|
"TypeScript",
|
||||||
|
"data transformation",
|
||||||
"ESM",
|
"ESM",
|
||||||
"utilities"
|
"utilities",
|
||||||
|
"npm"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
22
package.json
22
package.json
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartbuffer",
|
"name": "@push.rocks/smartbuffer",
|
||||||
"version": "3.0.2",
|
"version": "3.0.5",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A library for managing ArrayBufferLike structures including conversion between Base64 and Uint8Array, and buffer validation.",
|
"description": "A robust TypeScript library for managing binary data by converting between Base64 strings and Uint8Array, validating buffer-like objects, and ensuring data purity.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -37,17 +37,23 @@
|
|||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ArrayBuffer",
|
"ArrayBuffer",
|
||||||
"TypeScript",
|
|
||||||
"base64 conversion",
|
|
||||||
"Uint8Array",
|
"Uint8Array",
|
||||||
"data transformation",
|
"base64 conversion",
|
||||||
"binary data handling",
|
"binary data handling",
|
||||||
"buffer validation",
|
"buffer validation",
|
||||||
"modular programming",
|
"TypeScript",
|
||||||
|
"data transformation",
|
||||||
"ESM",
|
"ESM",
|
||||||
"utilities"
|
"utilities",
|
||||||
|
"npm"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uint8array-extras": "^1.1.0"
|
"uint8array-extras": "^1.1.0"
|
||||||
}
|
},
|
||||||
|
"homepage": "https://code.foss.global/push.rocks/smartbuffer",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://code.foss.global/push.rocks/smartbuffer.git"
|
||||||
|
},
|
||||||
|
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6"
|
||||||
}
|
}
|
||||||
|
12096
pnpm-lock.yaml
generated
12096
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartbuffer',
|
name: '@push.rocks/smartbuffer',
|
||||||
version: '3.0.2',
|
version: '3.0.5',
|
||||||
description: 'A library for managing ArrayBufferLike structures including conversion between Base64 and Uint8Array, and buffer validation.'
|
description: 'A robust TypeScript library for managing binary data by converting between Base64 strings and Uint8Array, validating buffer-like objects, and ensuring data purity.'
|
||||||
}
|
}
|
||||||
|
13
ts/index.ts
13
ts/index.ts
@ -12,7 +12,7 @@ export function base64ToUint8Array(base64: string): Uint8Array {
|
|||||||
|
|
||||||
export const isUint8Array = (obj: any): obj is Uint8Array => {
|
export const isUint8Array = (obj: any): obj is Uint8Array => {
|
||||||
return plugins.uInt8ArrayExtras.isUint8Array(obj);
|
return plugins.uInt8ArrayExtras.isUint8Array(obj);
|
||||||
}
|
};
|
||||||
|
|
||||||
export function isBufferLike(obj: any): obj is ArrayBufferLike | Buffer {
|
export function isBufferLike(obj: any): obj is ArrayBufferLike | Buffer {
|
||||||
// Check for ArrayBufferLike objects in any environment
|
// Check for ArrayBufferLike objects in any environment
|
||||||
@ -26,4 +26,13 @@ export function isBufferLike(obj: any): obj is ArrayBufferLike | Buffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ensurePureUint8Array(bufferArg: Uint8Array | Buffer): Uint8Array {
|
||||||
|
// Create a new Uint8Array with the same length as the buffer
|
||||||
|
const uint8Array: Uint8Array = new Uint8Array(bufferArg.length);
|
||||||
|
|
||||||
|
// Copy the contents of the Buffer to the new Uint8Array
|
||||||
|
uint8Array.set(bufferArg);
|
||||||
|
return uint8Array;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user