https://github.com/thgh/upload-deno
Upload temporary files to upload.deno.dev
https://github.com/thgh/upload-deno
Last synced: about 1 year ago
JSON representation
Upload temporary files to upload.deno.dev
- Host: GitHub
- URL: https://github.com/thgh/upload-deno
- Owner: thgh
- Created: 2021-10-28T15:37:32.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-28T17:59:16.000Z (over 4 years ago)
- Last Synced: 2024-12-11T16:49:08.873Z (over 1 year ago)
- Language: TypeScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
upload-deno
---
Inspired by https://file.io you can now upload files to https://file.deno.dev and they will be available for some time.
An example use case is uploading files to Airtable which requires you to host the file for a couple of seconds.
```tsx
![]()
async function upload() {
// Upload
const body = new FormData()
body.append('file', document.querySelector('[type=file]').files[0])
const uploaded = await fetch('https://file.deno.dev', { method:'POST', body }).then(r => r.json())
// Show result
document.querySelector('img').src = 'https://file.deno.dev' + uploaded.id
console.log('id', uploaded.id)
console.log('contentType', uploaded.contentType)
console.log('originalName', uploaded.originalName)
}
```