Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thecymaera/resource-converter


https://github.com/thecymaera/resource-converter

Last synced: 1 day ago
JSON representation

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.