@tater-archives/upload
v1.0.0
Published
Simple uploaded file reader utility for browser
Downloads
3
Readme
@tater-archives/upload
A simple utility to read a file as a string in the browser
Example Usage
// Get the input
const fileInput = document.getElementById('fileInput');
// Set the listener
fileInput.addEventListener('change', handleFileUpload(content => {
// ... do stuff with content
}))
In React/Preact:
<input
type="file"
onChange={handleFileUpload(content => {
/* ... do stuff with content */
})}
/>
You can use it in the browser via esm.sh or unpkg.
import { handleFileUpload } from 'https://esm.sh/@tater-archives/upload';
// or
import { handleFileUpload } from 'https://unpkg.com/@tater-archives/upload';