1.0.0 • Published 10 months ago

@tater-archives/upload v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@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';
1.0.0

10 months ago