https://github.com/cheminfo/uint8-base64
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.9%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: cheminfo
- License: other
- Language: TypeScript
- Default Branch: main
- Homepage: https://cheminfo.github.io/uint8-base64/
- Size: 150 KB
Statistics
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
- Releases: 2
Metadata Files
README.md
uint8-base64
You can find a lot of NPM libraries dealing with base64 encoding and decoding.
However, we could not find one that would have as input AND output an Uint8Array. This library does exactly this.
This library is pretty fast and will convert over 500 Mb per second in NodeJS as well as in the browser.
If you need at the end a text rather than an Uint8Array it is also extremely fast to convert the Uint8Array to text using a TextEncoder:
js
const base64 = encode(bytes);
const string = new TextDecoder('utf8').decode(base64);
Installation
$ npm i uint8-base64
Usage
encode
```js import { encode } from 'uint8-base64';
const result = encode(Uint8Array.from([65])); // an array containing 'A' // result is Uint8Array(4) 81, 81, 61, 61 ```
Encoding to text speed test
```js import { encode } from 'uint8-base64';
const bytes = new Uint8Array(256 * 1024 * 1024).map((_, i) => Math.floor(Math.random() * 256), );
console.time('base64'); const base64 = encode(bytes); const string = new TextDecoder('utf8').decode(base64); console.timeEnd('base64');
console.log(string.slice(0, 100)); ```
This code takes 330ms on my MacBook pro M4 to encode 256Mb of data. The encoding itself takes 240ms while the conversion to text takes 50ms.
decode
```js import { decode } from '..';
const result = decode(Uint8Array.from([81, 81, 61, 61])); // an array containing 'QQ==' // result is Uint8Array(1) 65 ```
License
The code was largely inspired by: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727
Owner
- Name: Cheminfo
- Login: cheminfo
- Kind: organization
- Website: https://www.cheminfo.org/
- Repositories: 242
- Profile: https://github.com/cheminfo
GitHub Events
Total
- Release event: 1
- Issue comment event: 2
- Push event: 14
- Pull request event: 2
- Create event: 2
Last Year
- Release event: 1
- Issue comment event: 2
- Push event: 14
- Pull request event: 2
- Create event: 2
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: about 6 hours
- Total issue authors: 0
- Total pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 1.0
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 4 hours
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 2.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- cheminfo-bot (4)
- lpatiny (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- npm 1,752 last-month
- Total dependent packages: 2
- Total dependent repositories: 2
- Total versions: 3
- Total maintainers: 1
npmjs.org: uint8-base64
Encode and decode base64 to and from Uint8Array
- Homepage: https://github.com/cheminfo/uint8-base64#readme
- License: MIT
-
Latest release: 1.0.0
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- @types/jest ^27.0.1 development
- eslint ^7.32.0 development
- eslint-config-cheminfo-typescript ^8.0.9 development
- jest ^27.1.0 development
- prettier ^2.3.2 development
- rimraf ^3.0.2 development
- ts-jest ^27.0.5 development
- typescript ^4.4.2 development
- JamesIves/github-pages-deploy-action releases/v4 composite
- actions/checkout v2 composite
- actions/setup-node v2 composite
- zakodium/typedoc-action v2 composite