express-sharp
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -0,1 +1,8 @@ | ||
## [4.2.2](https://github.com/pmb0/express-sharp/compare/v4.2.1...v4.2.2) (2020-06-20) | ||
### Bug Fixes | ||
* provide missing interface exports ([3cf55e8](https://github.com/pmb0/express-sharp/commit/3cf55e86228edf4478871325037ff6a3899826d9)) | ||
## [4.2.1](https://github.com/pmb0/express-sharp/compare/v4.2.0...v4.2.1) (2020-06-20) | ||
@@ -2,0 +9,0 @@ |
import 'reflect-metadata'; | ||
export * from './adapter'; | ||
export * from './express-sharp-client'; | ||
export * from './interfaces'; | ||
export * from './middleware/express-sharp.middleware'; | ||
export * from './transformer.service'; |
@@ -16,4 +16,5 @@ "use strict"; | ||
__exportStar(require("./express-sharp-client"), exports); | ||
__exportStar(require("./interfaces"), exports); | ||
__exportStar(require("./middleware/express-sharp.middleware"), exports); | ||
__exportStar(require("./transformer.service"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "express-sharp", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Real-time image processing for your express application", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,2 +0,5 @@ | ||
<p align="center">Real-time image processing for your express application.</p> | ||
<div align="center"> | ||
<img src="https://raw.github.com/pmb0/express-sharp/master/docs/express-sharp.gif" width="100%" /> | ||
<p>Real-time image processing for your express application.</p> | ||
</div> | ||
@@ -38,2 +41,3 @@ [![npm version](https://badge.fury.io/js/express-sharp.svg)](https://www.npmjs.com/package/express-sharp) | ||
- [Amazon S3](#amazon-s3) | ||
- [Custom](#custom) | ||
- [Caching](#caching) | ||
@@ -58,5 +62,6 @@ - [URL signing](#url-signing) | ||
```js | ||
const express = require('express') | ||
import express from 'express' | ||
import { expressSharp, FsAdapter, HttpAdapter } from 'express-sharp' | ||
const app = express() | ||
const { expressSharp, FsAdapter, HttpAdapter } = require('express-sharp') | ||
@@ -99,7 +104,8 @@ // Fetch original images via HTTP | ||
```js | ||
const { expressSharp } = require('express-sharp') | ||
import { expressSharp } from 'express-sharp' | ||
app.use('/some-http-endpoint', expressSharp(options)) | ||
``` | ||
Supported options: | ||
Supported `options`: | ||
@@ -123,3 +129,3 @@ | Name | Description | Default | | ||
```js | ||
const { FsAdapter } = require('express-sharp') | ||
import { FsAdapter } from 'express-sharp' | ||
@@ -134,3 +140,3 @@ const adapter = new FsAdapter('/path/to/images') | ||
```js | ||
const { HttpAdapter } = require('express-sharp') | ||
import { HttpAdapter } from 'express-sharp' | ||
@@ -153,3 +159,3 @@ const adapter = new HttpAdapter({ | ||
```js | ||
const { S3Adapter } = require('express-sharp') | ||
import { S3Adapter } from 'express-sharp' | ||
@@ -162,2 +168,20 @@ const bucketName = 'my-bucketname' | ||
### Custom | ||
If you needed your own adapters can be used. An "image adapter" is a class that implements the `ImageAdapter` interface: | ||
```ts | ||
import { ImageAdapter } from 'express-sharp' | ||
class MyAdapter implements ImageAdapter { | ||
async fetch(id: string): Promise<Buffer | undefined> { | ||
if (imageDoesNotExist(id)) { | ||
return undefined | ||
} | ||
return Buffer.from('my image blob') | ||
} | ||
} | ||
``` | ||
## Caching | ||
@@ -203,3 +227,3 @@ | ||
```js | ||
const { createClient } = require('express-sharp') | ||
import { createClient } from 'express-sharp' | ||
@@ -229,3 +253,3 @@ const endpoint = 'https://example.com/my-express-sharp-endpoint' | ||
```js | ||
const { createClient } = require('express-sharp') | ||
import { createClient } from 'express-sharp' | ||
@@ -253,3 +277,3 @@ const client = createClient('http://my-base-host', 'optional secret') | ||
[MIT](LICENSE) | ||
express-sharp is distributed under the MIT license. [See LICENSE](./LICENSE) for details. | ||
@@ -256,0 +280,0 @@ [coveralls-image]: https://img.shields.io/coveralls/pmb0/express-sharp/master.svg |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
899865
985
274