Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
:bangbang: Work in progress. The API will be changed. Do not use it. Really. :bangbang:
Image-fns provides toolset for manipulating images in a browser
npm install image-fns
or
yarn add image-fns
const input = document.querySelector('#file')
const preview = document.querySelector('#result')
input.addEventListener('change', e =>
fromFile(e.target.files[0])
.then(canvas => shrink(canvas, 300, 300))
.then(canvas => Promise.all([canvas, hasTransparency(canvas)]))
.then(([canvas, isTransparent]) =>
toImage(canvas, isTransparent ? 'png' : 'jpeg', 0.1)
)
.then(append)
)
const append = node => preview.appendChild(node)
const convertToBetterFormat = async file => {
const [formats, canvas] = await Promise.all([
getSupportedFormats(),
fromFile(file),
])
let format = 'jpeg'
if (formats.includes('webp')) {
format = 'webp'
} else if (hasTransparency(canvas)) {
format = 'png'
}
return toFile({ name: file.name, format, quality: 0.8 }, canvas)
}
input.addEventListener('change', async e => {
const file = await convertToBetterFormat(e.target.files[0])
sendToServer(file)
})
If you think you ran into something in Uploadcare libraries which might have security implications, please hit us up at bugbounty@uploadcare.com or Hackerone.
We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.
Issues and PR‘s are welcome. You can provide your feedback or drop us a support request at hello@uploadcare.com.
1.0.0-alpha
The first public alpha release.
shrink
function to shrink any image.canvas
hasTransparency
functionFAQs
## Project Status
The npm package image-fns receives a total of 1 weekly downloads. As such, image-fns popularity was classified as not popular.
We found that image-fns 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.