https://github.com/alfredosalzillo/url-to-file
An utility to convert url to File object.
https://github.com/alfredosalzillo/url-to-file
Last synced: about 22 hours ago
JSON representation
An utility to convert url to File object.
- Host: GitHub
- URL: https://github.com/alfredosalzillo/url-to-file
- Owner: alfredosalzillo
- Created: 2021-08-11T13:24:22.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-13T08:11:57.000Z (about 4 years ago)
- Last Synced: 2025-02-04T04:31:29.148Z (8 months ago)
- Language: TypeScript
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# url-to-file

[](https://codecov.io/gh/alfredosalzillo/url-to-file)
[](https://deno.land/x/url_to_file)
[](https://badge.fury.io/js/url-to-file)
[](https://github.com/semantic-release/semantic-release)A utility to convert url to file.
## Install
Install via npm or yarn.
```bash
npm i -D url-to-file
yarn add url-to-file
```Use on Deno.
```javascript
import { fetchFile } from 'https://deno.land/x/url_to_file@v1.1.0/main.ts'const file = await fetchFile('https://picsum.photos/200/300', 'image.png', {
type: 'image/png',
})
```## API
### fetchFile
Fetch an url and return a File object.
```javascript
import { fetchFile } from 'url-to-file'const file = await fetchFile('https://picsum.photos/200/300', 'image.png', {
type: 'image/png',
})
```