Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
file-dialog
Advanced tools
Directly call the file browser dialog from your code, and get back the resulting array of FileList. Handy for when you need to post files via AJAX/Fetch. No more hacky hiding of <input type="file">
elements. Support for Callbacks & Promises!
npm install file-dialog --save
const fileDialog = require('file-dialog')
or with ES6 modules import fileDialog from 'file-dialog'
<script>
includes<script>
fileDialog
Get a File via a promise and POST to server via Fetch
fileDialog()
.then(file => {
const data = new FormData()
data.append('file', file[0])
data.append('imageName', 'flower')
// Post to server
fetch('/uploadImage', {
method: 'POST',
body: data
})
})
Allow user to select only an image file
fileDialog({ accept: 'image/*' })
.then(files => {
// files contains an array of FileList
})
Allow user to select only images or videos
fileDialog({ accept: ['image/*', 'video/*'] })
.then(files => {
// files contains an array of FileList
})
Allow user to select multiple image files at once
fileDialog({ multiple: true, accept: 'image/*' })
.then(files => {
// files contains an array of FileList
})
Classic callback version of the above
fileDialog({ multiple: true, accept: 'image/*' }, files => {
// files contains an array of FileList
})
FAQs
Call the file dialog directly in your code
The npm package file-dialog receives a total of 8,403 weekly downloads. As such, file-dialog popularity was classified as popular.
We found that file-dialog 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.