Files
dashlibstorage/API.pic.md
2026-09-24 23:26:25 +02:00

62 lines
1.4 KiB
Markdown

# pic
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `pic.getImageByHash`
*Source: `src/store/pic/getImageByHash.js`*
Returns the full-size image (AVIF) for a given hash.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `fullHash` | `string` | The full image hash. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{buffer: Buffer, w: number, h: number, size: number, contentType: string}>` — The full image.
**Throws**
`Error` — If the image is not found.
**Example**
```js
const image = await store.pic.getImageByHash(42, 'abc123');
// => { buffer, w, h, size, contentType: 'image/avif' }
```
## `pic.getThumbByHash`
*Source: `src/store/pic/getThumbByHash.js`*
Returns the thumbnail image (AVIF) for a given hash.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `fullHash` | `string` | The full image hash. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{buffer: Buffer, w: number, h: number, contentType: string}>` — The thumbnail image.
**Throws**
`Error` — If the image is not found.
**Example**
```js
const thumb = await store.pic.getThumbByHash(42, 'abc123');
// => { buffer, w, h, contentType: 'image/avif' }
```