Installations
npm install toab
Score
67
Supply Chain
86.1
Quality
75.8
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Developer
DanielJDufour
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
16.15.1
NPM Version
8.11.0
Statistics
26 Commits
3 Watching
1 Branches
1 Contributors
Updated on 11 Nov 2021
Bundle Size
1.64 kB
Minified
655.00 B
Minified + Gzipped
Languages
JavaScript (72.1%)
HTML (27.9%)
Total Downloads
Cumulative downloads
Total Downloads
13,310
Last day
-13.2%
66
Compared to previous day
Last week
-4.5%
170
Compared to previous week
Last month
-48.2%
763
Compared to previous month
Last year
598.3%
8,875
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
2
toab
To Array Buffer: Convert Buffer, Data URLs, Files, Response, Text, and Typed Arrays to Array Buffers
install
1npm install toab
usage
convert file buffer to array buffer
1const fs = require("fs"); 2const toab = require("toab"); 3 4const buffer = fs.readFileSync("test.png"); 5const arrayBuffer = await toab(buffer);
convert File to an array buffer
1document.querySelector('input').addEventListener('change', async event => { 2 const file = event.target.files[0]; 3 const arrayBuffer = await toab(file); 4});
convert data url to array buffer
1// the context comes from a canvas element 2const url = context.toDataURL('image/jpeg'); 3// url is data:image/jpeg;base64,/9j/4AAQSkZJRgABA" 4const arrayBuffer = await toab(url);
convert data view to array buffer
1const arrayBuffer = await toab(dataView)
convert typed arrays to array buffers
1const arrayBuffer = await toab(int8Array) 2const arrayBuffer = await toab(uint8Array) 3const arrayBuffer = await toab(int16Array) 4const arrayBuffer = await toab(uint16Array) 5const arrayBuffer = await toab(int32Array) 6const arrayBuffer = await toab(uint32Array) 7const arrayBuffer = await toab(float32Array) 8const arrayBuffer = await toab(float64Array) 9const arrayBuffer = await toab(bigInt64Array) 10const arrayBuffer = await toab(bigUint64Array)
convert text to an array buffer (in UTF-8)
1const arrayBuffer = await toab("Hello, I'm a String.");
convert fetch Response to an array buffer
1const response = await fetch("https://example.org/file.dat"); 2const arrayBuffer = await toab(response); 3 4// or for a one-line solution 5const arrayBuffer = await fetch("https://example.org/file.dat").then(toab);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Creative Commons Zero v1.0 Universal: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Score
3
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More