# @digitalmasterpieces/styles-client

> Client for processing images via the Stylization-as-a-Service REST API by Digital Masterpieces GmbH.

Latest version **2.3.1** (published 2021-12-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @digitalmasterpieces/styles-client
pnpm add @digitalmasterpieces/styles-client
yarn add @digitalmasterpieces/styles-client
bun add @digitalmasterpieces/styles-client
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.1 |
| Published | 2021-12-16 |
| First published | 2020-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 247.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Digital Masterpieces |
| Maintainers | digitalmasterpieces-admin, xr4z0r |
| Keywords | styles, client, stylization, sdk, digitalmasterpieces, visual, media, processing, art |

## Links

- npm: https://www.npmjs.com/package/@digitalmasterpieces/styles-client
- Repository: https://bitbucket.org/digitalmasterpieces/stylization-sdk
- Homepage: https://saas.digitalmasterpieces.com
- Issues: https://bitbucket.org/digitalmasterpieces/stylization-sdk/issues
- npm.io page: https://npm.io/package/@digitalmasterpieces/styles-client

## Dependencies (2)

- [rest-api-controller](https://npm.io/package/rest-api-controller.md) ^1.4.7
- [@digitalmasterpieces/asset-registry](https://npm.io/package/@digitalmasterpieces/asset-registry.md) ^1.0.4

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.3.1 (latest) — 2021-12-16
- 2.3.0 — 2021-10-28
- 2.2.2 — 2021-05-27
- 2.2.1 — 2021-04-20
- 2.2.0 — 2021-04-20
- 2.1.0 — 2021-01-29
- 2.0.2 — 2021-01-22
- 2.0.1 — 2021-01-22
- 2.0.0 — 2021-01-22
- 1.1.8 — 2021-01-20
- 1.1.7 — 2021-01-20
- 1.1.6 — 2021-01-20
- 1.1.5 — 2020-12-10
- 1.1.4 — 2020-11-16
- 1.1.3 — 2020-11-16
- … 4 more at https://npm.io/package/@digitalmasterpieces/styles-client/versions

## README

@digitalmasterpieces/
# styles-client

[![npm](https://img.shields.io/npm/v/@digitalmasterpieces/styles-client)](https://www.npmjs.com/package/@digitalmasterpieces/styles-client)
![npm License](https://img.shields.io/npm/l/@digitalmasterpieces/styles-client)
![npm bundle size](https://img.shields.io/bundlephobia/min/@digitalmasterpieces/styles-client)
![Libraries.io dependency status for latest release, scoped npm package](https://img.shields.io/librariesio/release/npm/@digitalmasterpieces/styles-client)
![Type declarations](https://badgen.net/npm/types/@digitalmasterpieces/styles-client)

Client for processing images via the Stylization-as-a-Service REST API by Digital Masterpieces GmbH.

## Installing

You can install the StylesClient using NPM or Yarn to get the latest version of our library.

> `npm install @digitalmasterpieces/styles-client`

For usage from a CDN we recommend using [Skypack](https://www.skypack.dev/) CDN. The StylesClient package is accessable at the following URL:

> `https://cdn.skypack.dev/@digitalmasterpieces/styles-client`

---

## Usage

When using the CDN URL you need to add your script tag of type `module` to the HTML. Then you can initialize the client as follows:

```typescript
import StylesClient from "https://cdn.skypack.dev/@digitalmasterpieces/styles-client";

const client = new StylesClient({
	apiKey: { id: "<your-key-id>", key: "<your-api-key>" },
});
```

Otherwise, when using Node.js in combination with TypeScript or ES modules:

```typescript
import StylesClient from "@digitalmasterpieces/styles-client";

const client = new StylesClient({
	apiKey: { id: "<your-key-id>", key: "<your-api-key>" },
});
```

With the client initialized you can use it as follows:

```typescript
import { Pipeline } from "@digitalmasterpieces/styles-client";

// Get a list of all available processing operations
const operations = await client.getOperations();

// Get a specific operation you want to use for processing
const operation = await client.getOperation(operations[0].id);

// Create a processing pipeline and use it for processing an image
const pipeline = new Pipeline();

pipeline.add(operation);

const image = /* your image to process */
const processedImage = await client.process(image, pipeline);
```

When using the client in browser your `image` should be a `File`. When you use the client on server-side with Node.js you could use either a `Buffer` or a `Readable` stream.

In browser this could look like:

```typescript
const image = document.querySelector("#file-input").files[0];
```

In Node.js you could achieve it with the following:

```typescript
// Using an image from file system as a readable stream
const image = {
	data: fs.createReadStream(path.join(IMAGE_DIR, "image.png")),
	mimetype: "image/png",
	name: "image.png",
};

// Using an image from file system as a buffer
const image = {
	data: fs.readFileSync(path.join(IMAGE_DIR, "image.png")),
	mimetype: "image/png",
	name: "image.png",
};
```

---

The full documentation with some usage examples is available [here](https://saas.digitalmasterpieces.com/docs/sdk-documentation/styles-client).

To learn more about the Stylization SDK visit our homepage at [https://saas.digitalmasterpieces.com](https://saas.digitalmasterpieces.com).

Get your own API key [here](https://saas.digitalmasterpieces.com/#register).

Try our demo application [here](https://saas.digitalmasterpieces.com/app).

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/@digitalmasterpieces/styles-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
