# seratojs

> Manage Serato Crates programatically via NodeJS.

Latest version **3.2.0** (published 2021-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install seratojs
pnpm add seratojs
yarn add seratojs
bun add seratojs
```

## 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 | 3.2.0 |
| Published | 2021-11-26 |
| First published | 2019-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Bryan Collazo |
| Maintainers | bcollazo |
| Keywords | serato, javascript, music, crates, dj |

## Links

- npm: https://www.npmjs.com/package/seratojs
- Repository: https://github.com/bcollazo/seratojs
- Homepage: https://github.com/bcollazo/seratojs#readme
- Issues: https://github.com/bcollazo/seratojs/issues
- npm.io page: https://npm.io/package/seratojs

## Recent versions

- 3.2.0 (latest) — 2021-11-26
- 3.1.0 — 2021-11-20
- 3.0.0 — 2021-11-20
- 2.0.0 — 2020-02-23
- 1.0.0 — 2019-06-18
- 0.1.0 — 2019-06-18
- 0.0.1 — 2019-06-18

## README

# seratojs

Manage Serato Crates Programatically in NodeJS.

## Installing

```
npm install seratojs
```

## Usage

```javascript
const seratojs = require("seratojs");

// List all crates defined by user.
const crates = seratojs.listCratesSync();
console.log(crates);

// List all song filepaths in a given crate.
const crate = crates[0];
const songs = crate.getSongPathsSync();
console.log(songs);

// Create a crate
const newCrate = new seratojs.Crate("ProgramaticallyCreatedCrate");
newCrate.addSong("Users/bcollazo/Music/song.mp3");
newCrate.addSong("C:\\Users\\bcollazo\\Music\\second_song.mp3");
newCrate.saveSync();
```

Asynchronous (await-async / promise-based) API:

```javascript
const seratojs = require("seratojs");

(async function () {
  const crates = await seratojs.listCrates();
  const songs = await crates[0].getSongPaths();
  const newCrate = new seratojs.Crate("ProgramaticallyCreatedCrate");
  newCrate.addSong("Users/bcollazo/Music/song.mp3");
  await newCrate.save();
})();
```

Adding songs from different drives will replicate Serato's behavior
of saving the crate in all drives participating in the crate.

```javascript
const crate = new seratojs.Crate("MyCrate");
crate.addSong("D:\\Music\\song1.mp3");
crate.addSong("C:\\Users\\bcollazo\\Music\\song2.mp3");
crate.saveSync(); // will save in D:\\_Serato_ and C:\\Users\\bcollazo\\Music\\_Serato_
```

## Notes

SeratoJS tries to sanitize crate name before creation. This is to allow crates named 'Some / Name' to be created without giving trouble. It will be created as 'Some - Name' instead.

### Migrating from 1.x to 2.x

- Change `crate.getSongPaths()` to `crate.getSongPathsSync()` or `await crate.getSongPaths()`.
- Change `newCrate.save()` to `newCrate.saveSync()` or `await newCrate.save()`.

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