# is-psd

> Check if a Buffer/Uint8Array is a PSD image

Latest version **2.0.0** (published 2021-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-psd
pnpm add is-psd
yarn add is-psd
bun add is-psd
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-08-10 |
| First published | 2014-04-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | psd, photoshop, document, graphics, image, img, picture, photo, type, detect, check, is, exif, binary, buffer, uint8array |

## Links

- npm: https://www.npmjs.com/package/is-psd
- Repository: https://github.com/sindresorhus/is-psd
- Homepage: https://github.com/sindresorhus/is-psd#readme
- Issues: https://github.com/sindresorhus/is-psd/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/is-psd

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-08-10
- 1.0.1 — 2018-03-22
- 1.0.0 — 2014-08-14
- 0.1.1 — 2014-04-29
- 0.1.0 — 2014-04-21

## README

# is-psd

> Check if a Buffer/Uint8Array is a [PSD](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) image

## Install

```
$ npm install is-psd
```

## Usage

##### Node.js

```js
import {readChunkSync} from 'read-chunk';
import isPsd from 'is-psd';

const buffer = readChunkSync('unicorn.psd', {length: 4});

isPsd(buffer);
//=> true
```

##### Browser

```js
const xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.psd');
xhr.responseType = 'arraybuffer';

xhr.onload = () => {
	isPsd(new Uint8Array(this.response));
	//=> true
};

xhr.send();
```

## API

### isPsd(buffer)

Accepts a `Buffer` (Node.js) or `Uint8Array`.

It only needs the first 4 bytes.

## Related

- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array

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