# spc-reader

> JS library for reading SPC700 files

Latest version **1.1.1** (published 2019-06-01) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install spc-reader
pnpm add spc-reader
yarn add spc-reader
bun add spc-reader
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-06-01 |
| First published | 2019-05-14 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 2 |
| Unpacked size | 84.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 2 |
| Author | Matt Hackmann |
| Maintainers | dxprog |
| Keywords | SNES, typescript |

## Links

- npm: https://www.npmjs.com/package/spc-reader
- Repository: https://github.com/dxprog/spc-reader
- Homepage: https://github.com/dxprog/spc-reader#readme
- Issues: https://github.com/dxprog/spc-reader/issues
- npm.io page: https://npm.io/package/spc-reader

## Dependencies (2)

- [typescript](https://npm.io/package/typescript.md) ^3.4.5
- [@types/node](https://npm.io/package/@types/node.md) ^12.0.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2019-06-01
- 1.1.0 — 2019-06-01
- 1.0.1 — 2019-05-15
- 1.0.0 — 2019-05-14

## README

[![Build Status](https://travis-ci.org/dxprog/spc-reader.svg)](https://travis-ci.org/dxprog/spc-reader)
[![](https://coveralls.io/repos/github/dxprog/spc-reader/badge.svg)](https://coveralls.io/github/dxprog/spc-reader)

# SpcReader

SpcReader is a JS library for reading and parsing date from SPC700 files.

## Installation

To install SpcReader into your project:

```bash
npm i --save spc-reader
```

## Usage

SpcReader's default export is an async factory method for parsing SPCs.

```typescript
import SpcReader, { ISpc } from 'spc-reader';

// Read by file path
const mySpc: ISpc = await SpcReader('aquatic-ambiance.spc');

// Read by buffer
const anotherSpc: ISpc = await SpcReader(fs.readFileSync('blargg-stage.spc'));
```

## Public Exports

In addition to `SpcReader`, the following items are also exported for public use.

### ISpc

`ISpc` is an interface that describes the parts and data of an SPC file.

Property | Type | Description
-------- | ---- | -----------
hasID666Metadata | `boolean` | Whether the SPC file contains ID666 metadata. This is the SPC equivalent of ID3 tags.
regPC | `number` | The program counter register.
regA | `number` | The accumulator (A) register.
regX | `number` | The X register.
regY | `number` | The Y register.
regPSW | `number` | The program status word register.
regSP | `number` | The lower byte of the stack pointer.
metadata | `IId666?` | Any ID666 metadata available. If there is none, is `undefined`.
programData | `Uint8Array` | The SPC program data. Will always be 65,536 bytes.
dspRegisters | `Uint8Array` | The DSP registers data. Will always be 128 bytes.
iplRam | `Uint8Array` | The data from the IPL RAM area. Will always be 64 bytes.

### IId666

`IId666` is an interface that describes the various metadata properties of the ID666 tags.

Property | Type | Description
-------- | ---- | -----------
title | `string` | Title of the song.
game | `string` | The name of the game the song is from.
dumpedBy | `string` | The name of the person/program that dumped the SPC.
comments | `string` | Free form comments field.
dumpedOn | `Date` | The date the SPC data was dumped. Not guaranteed to be a real date.
length | `number` | The length of the song in seconds before beginning fade out.
fadeOutLength | `number` | The length of the fade out in milliseconds.
artist | `string` | The name of the song's artist.
defaultChannelDisabled | `boolean` | I honestly don't know...
emulator | `Emulator` | An ID code identifying the emulator that the SPC was dumped from.

### Emulator

`Emulator` is an `enum` defining some of the ID codes for the `emulator` property of the `IId666` interface.

Value | Name
----- | ----
0 | Unknown
1 | ZSNES
2 | Snes9x

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