Gathering detailed insights and metrics for base64-coverter
Gathering detailed insights and metrics for base64-coverter
Gathering detailed insights and metrics for base64-coverter
Gathering detailed insights and metrics for base64-coverter
npm install base64-coverter
Typescript
Module System
Node Version
NPM Version
72.3
Supply Chain
91.5
Quality
75
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
283
Last Day
1
Last Week
2
Last Month
14
Last Year
232
1 Commits
1 Watchers
1 Branches
1 Contributors
Updated on May 07, 2024
Minified
Minified + Gzipped
Latest Version
1.2.0
Package Id
base64-coverter@1.2.0
Unpacked Size
119.35 kB
Size
40.78 kB
File Count
32
NPM Version
9.8.1
Node Version
18.18.2
Published on
May 07, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-66.7%
2
Compared to previous week
Last Month
133.3%
14
Compared to previous month
Last Year
354.9%
232
Compared to previous year
2
This package enables the conversion of Base64-encoded images to tensor objects using pure JavaScript, compatible with TensorFlow.js.
Install the package using npm:
1npm install base64-to-tensor --save
Ensure @tensorflow/tfjs-core
is installed alongside a valid TensorFlow backend. Choose between the synchronous package jpeg-js for full blocking sync or the asynchronous package sharp for non-blocking async operations:
1# For synchronous operations: 2npm install @tensorflow/tfjs-core jpeg-js 3 4# For asynchronous operations: 5npm install @tensorflow/tfjs-core sharp
Refer to the convert.test.ts file for example usage. Below are snippets demonstrating both synchronous and asynchronous conversions:
1import { convert, convertAsync } from "base64-to-tensor"; 2import { setBackend } from "@tensorflow/tfjs-core"; 3import "@tensorflow/tfjs-backend-wasm"; 4 5await setBackend("wasm"); 6 7// Synchronous conversion (jpeg-js) 8const tensorSync = convert(mybase64); // Ensure mybase64 is a valid JPEG 9 10// Asynchronous conversion (sharp) 11const tensorAsync = await convertAsync(mybase64); // Enhanced performance 12 13// Example tensor output 14{ 15 kept: false, 16 isDisposedInternal: false, 17 shape: [189, 300, 3], 18 dtype: "int32", 19 size: 170100, 20 strides: [900, 3], 21 dataId: { id: 1 }, 22 id: 1, 23 rankType: "3", 24}
Using pure JavaScript for image conversion to tensors offers several advantages:
cairo
or other native image development converters.Performance benchmarks conducted on a Mac M1 (64GB RAM):
Test Case | Characters | Size | Synchronous | Asynchronous |
---|---|---|---|---|
JPEG | 26,791 | 26.16 KB | 100 ms | 50 ms |
No vulnerabilities found.
No security vulnerabilities found.