Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thecymaera/resource-converter
https://github.com/thecymaera/resource-converter
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/thecymaera/resource-converter
- Owner: TheCymaera
- Created: 2021-08-14T19:25:57.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-09T11:07:17.000Z (about 2 years ago)
- Last Synced: 2024-04-25T09:21:27.432Z (8 months ago)
- Language: TypeScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Resource converter (3.0.0)
Resource converter is a JavaScript/TypeScript library for converting between resources such as URLs, images, blobs, generators and readable streams.## Installation
Install via [npm](https://www.npmjs.com/package/resource-converter):
```shell
npm install resource-converter
```## Example usage
```typescript
import * as converter from "resource-converter";// create url from blob
await converter.dataURL.fromBlob(blob);// load image from url
await converter.image.fromURL(url);// create iterator from readable stream
const response = await fetch("https://www.example.com/");
converter.asyncGenerator.fromReadableStream(response.body);// create generator from iterator
converter.generator.fromIterator(iterator);
converter.asyncGenerator.fromAsyncIterator(asyncIterator);
```## License
Licensed under MIT.
All files can be used for commercial or non-commercial purposes. Do not resell. Attribution is appreciated but not due.