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.
easy-file-picker
Advanced tools
Easy File Picker is a straightforward library with no dependencies to upload/pick/read files in the browser.
Easy File Picker is a straightforward library with no dependencies to upload/pick/read files in the browser that can be used with any frontend framework.
npm install easy-file-picker
Example on how to upload a file in various javascript frameworks:
HTML:
<button id="uploader">Upload!</button>
Javascript/TypeScript:
import { getFile, uploadFilesTo } from 'easy-file-picker';
document.querySelector("#uploader").addEventListener("click", () => getFile().then((file) => { if(file) uploadFilesTo("http://example.com", file)}));
HTML:
<button (click)="uploadFile()">Upload!</button>
TypeScript:
import { getFile, uploadFilesTo } from 'easy-file-picker';
async uploadFile(): Promise<void> {
const file = await getFile();
if(file) {
await uploadFilesTo("http://example.com", file);
}
}
Javascript:
import { getFile, uploadFilesTo } from 'easy-file-picker';
async uploadFile() {
const file = await getFile();
if(file) {
await uploadFilesTo("http://example.com", file);
}
}
render() {
return <button onClick={uploadFile}>Upload!</button>;
}
HTML:
<button @click="uploadFile">Upload!</button>
Javascript:
import { getFile, uploadFilesTo } from 'easy-file-picker';
methods: {
async uploadFile() {
const file = await getFile();
if(file) {
await uploadFilesTo("http://example.com", file);
}
}
}
Svelte:
<script>
import { getFile, uploadFilesTo } from 'easy-file-picker';
async function uploadFile() {
const file = await getFile();
if(file) {
await uploadFilesTo("http://example.com", file);
}
}
</script>
<button on:click={uploadFile}>Upload!</button>
Shows a system file dialog where the user can select a single file and returns it. Returns null if no file is selected.
function getFile(options?: FilePickerOptions): Promise<File | null>
Shows a system file dialog where the user can select multiple files and returns them. Returns empty array if no file is selected.
function getFiles(options?: FilePickerOptions): Promise<File[]>
Shows a system file dialog where the user can select a single file and returns a string representation of the file content. Returns null if no file is selected.
function getFileAsString(options?: FilePickerOptions): Promise<FileStringResult | null>
Shows a system file dialog where the user can select multple files and returns string representations of the selected files content. Returns empty array if no file is selected.
function getFilesAsString(options?: FilePickerOptions): Promise<FileStringResult[]>
Makes a HTTP request to the indicated url with the files as the body (content-type: form data).
function uploadFilesTo(url: string, files: File | File[], httpMethod: 'POST' | 'PUT' = 'POST'): Promise<Response>
Name | Type | Required | Default | Description |
---|---|---|---|---|
acceptedExtensions | string[] | NO | "" | An array of unique file type specifiers, describing which file types to allow. |
Name | Type | Required | Default | Description |
---|---|---|---|---|
name | string | YES | undefined | The name of the file. |
size | number | YES | undefined | The size of the file in bytes. |
type | string | YES | undefined | The MIME type of the file. |
lastModified | number | YES | undefined | The last modified time of the file, in millisecond since the UNIX epoch. |
webkitRelativePath | string | YES | undefined | The path the URL of the file is relative to. |
content | string | YES | undefined | The string representation of the file's content |
Version 1.1:
Version 1.0.4:
Version 1.0.3:
Version 1.0.2:
Version 1.0.1:
Version 1.0:
No FAQs for now. (⌐■_■)
FAQs
Easy File Picker is a straightforward library with no dependencies to upload/pick/read files in the browser.
The npm package easy-file-picker receives a total of 59 weekly downloads. As such, easy-file-picker popularity was classified as not popular.
We found that easy-file-picker demonstrated a healthy version release cadence and project activity because the last version was released less than 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.