# has-bytes

> Quickly Determine if an Array Buffer, Buffer, or Uint8Array contains Specific Sequences of Bytes

Latest version **0.0.2** (published 2020-11-17) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install has-bytes
pnpm add has-bytes
yarn add has-bytes
bun add has-bytes
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-11-17 |
| First published | 2020-11-17 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 131.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daniel J. Dufour |
| Maintainers | danieljdufour |
| Keywords | array, sequences, bytes, subsequences, uint8array |

## Links

- npm: https://www.npmjs.com/package/has-bytes
- Repository: https://github.com/DanielJDufour/has-bytes
- Homepage: https://github.com/DanielJDufour/has-bytes#readme
- Issues: https://github.com/DanielJDufour/has-bytes/issues
- npm.io page: https://npm.io/package/has-bytes

## Dependencies (1)

- [has-subarrays](https://npm.io/package/has-subarrays.md) 0.0.2

## Recent versions

- 0.0.2 (latest) — 2020-11-17
- 0.0.1 — 2020-11-17

## README

# has-bytes
Quickly Determine if a File has Certain Byte Sequences

# background
You can use this to quickly identify a file type

# install
```bash
npm install has-bytes
```

# usage
```javascript
const fs = require("fs");
const hasBytes = require("./has-bytes");

const buffer = fs.readFileSync("./data/flower.jpg");
const { result } = hasBytes({
    data: buffer,
    debug: false, // set debug to true for increased logging
    sequences: {
        magic: [255, 216, 255], // magic number (including start of file)
        EOI: [0xFF, 0xD9] // end of file indicator
    }
});
// result is true
```

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