Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Convert input array to uint8 array, detecting floats if required. Useful to ensure that an input array contains pixels/colors.
var u8 = require('to-uint8')
var pixels = u8([0,0,0,1, 1,1,1,1]) // <Uint8Array 0,0,0,255, 255,255,255,255>
u8data = u8(data, detectFloat=true)
Return Uint8Array u8data
with input data
values, possibly converted from floats, if required. data
can be an array, array of arrays, typed array, buffer, arraybuffer, base64 string or any other container.
u8(new Uint16Array([0, 1, 2])) // <Uint8Array 0, 1, 2>
u8(new Float32Array([0, .5, 1])) // <Uint8Array 0, 127, 255>
u8(new Float64Array([0, .5, 1])) // <Uint8Array 0, 127, 255>
u8([0, .5, 1]) // <Uint8Array 0, 127, 255>
// untyped array with int-ish values doesn't get converted
u8([0, 1, 255]) // <Uint8Array 0, 1, 255>
// unless passed a flag to force conversion
u8([0, 1, 255], false) // <Uint8Array 0, 255, 255>
(c) 2018 Dmitry Yv. MIT License
FAQs
Convert data to Uint8Array
The npm package to-uint8 receives a total of 24,981 weekly downloads. As such, to-uint8 popularity was classified as popular.
We found that to-uint8 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.