update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 17:23:03 +02:00
parent 9a4859f6a0
commit 30306f3a40
4 changed files with 117 additions and 32 deletions

View File

@ -5,17 +5,26 @@
"githost": "code.foss.global", "githost": "code.foss.global",
"gitscope": "push.rocks", "gitscope": "push.rocks",
"gitrepo": "smartbuffer", "gitrepo": "smartbuffer",
"description": "handle ArrayBufferLike structures", "description": "A module for handling ArrayBufferLike structures, including conversion and validation utilities.",
"npmPackagename": "@push.rocks/smartbuffer", "npmPackagename": "@push.rocks/smartbuffer",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks",
"keywords": [
"typescript",
"arraybuffer",
"buffer conversion",
"base64",
"buffer validation",
"utility",
"data processing"
]
} }
}, },
"npmci": { "npmci": {
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
}, },
"tsdocs": { "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" "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

@ -2,7 +2,7 @@
"name": "@push.rocks/smartbuffer", "name": "@push.rocks/smartbuffer",
"version": "1.0.7", "version": "1.0.7",
"private": false, "private": false,
"description": "handle ArrayBufferLike structures", "description": "A module for handling ArrayBufferLike structures, including conversion and validation utilities.",
"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",
@ -34,5 +34,14 @@
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"keywords": [
"typescript",
"arraybuffer",
"buffer conversion",
"base64",
"buffer validation",
"utility",
"data processing"
] ]
} }

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 handle ArrayBufferLike structures
## Availabililty and Links ## Install
* [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/)
## Status for master To install `@push.rocks/smartbuffer`, use the following command with npm:
Status Category | Status Badge ```sh
-- | -- npm install @push.rocks/smartbuffer --save
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) or with yarn:
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) ```sh
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) yarn add @push.rocks/smartbuffer
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) This will add `@push.rocks/smartbuffer` to your project's dependencies and you'll be ready to use it in your application.
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)
## Usage ## 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) First, import the functions you need from the module:
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![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.