Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
aurelia-files
Advanced tools
A simple attribute plugin for Aurelia to simplify loading files with the HTML5 FileReader
A simple aurelia attribute to allow you to load files into the browser, using the HTML5 FileReader functionality, also supports drag and drop.
with jspm
jspm install grofit/aurelia-files
then
aurelia.use.plugin("aurelia-files");
You can see the code and everything in the examples folder!
A simple example of allowing a user to load a file and then callback with the (file, data) arguments:
<input type="file" id="some-file-element" files="on-loaded.bind: SomeFileLoadedCallback" />
// some VM
export class SomeVM
{
SomeFileLoadedCallback(file, data) {
// Do something with file (js file) and data (content of the file)
}
// Remember if you need to access the *this* scope use
// SomeFileLoadedCallback = (file, data) => { ... }
}
A more complicated example with custom settings:
<input id="some-files-element" files="on-loaded.bind: SomeLoadedCallback; on-progress.bind: SomeProgressCallback; on-error.bind: SomeErrorCallback, file-filter.bind: 'image.*', read-as.bind: 'binary' }" />
As shown above you can hook into any of the file loading events and get access to the data to display things like progress bars, and custom file filters, which although the accepts attribute should enforce this for you but does not currently work in all browsers. So in this case you can constrain loaded files and just ignore ones that dont match the pattern. Finally it is loading the data as a binary string in the above example, however this can be converted to use other supported types.
The available options for this binding are:
FAQs
A simple attribute plugin for Aurelia to simplify loading files with the HTML5 FileReader
We found that aurelia-files 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
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.