2025-02-07 21:23:32 -05:00
|
|
|
# PackwizJS
|
|
|
|
|
2025-02-09 16:28:19 -06:00
|
|
|
[](https://packwizjs.csw.im)
|
2025-02-09 16:15:10 -06:00
|
|
|
|
2025-02-09 17:04:05 -06:00
|
|
|
A simple JavaScript module to parse the contents of [Packwiz](https://github.com/packwiz/packwiz) index files.
|
2025-02-09 13:17:26 -06:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
2025-02-09 17:01:16 -06:00
|
|
|
You can install PackwizJS with your package manager of choice.
|
|
|
|
|
|
|
|
### npm
|
|
|
|
|
|
|
|
```sh
|
2025-02-09 17:26:54 -06:00
|
|
|
npm install --save packwizjs
|
2025-02-09 17:01:16 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
### pnpm
|
|
|
|
|
|
|
|
```sh
|
|
|
|
pnpm add packwizjs
|
|
|
|
```
|
|
|
|
|
|
|
|
### yarn
|
|
|
|
|
|
|
|
```sh
|
|
|
|
yarn add packwizjs
|
|
|
|
```
|
|
|
|
|
|
|
|
### bun
|
|
|
|
|
|
|
|
```sh
|
|
|
|
bun add packwizjs
|
|
|
|
```
|
2025-02-09 13:17:26 -06:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2025-02-09 14:03:02 -06:00
|
|
|
See the [documentation](https://packwizjs.csw.im) for more information.
|
2025-02-09 13:17:26 -06:00
|
|
|
|
|
|
|
### Basic Example
|
|
|
|
|
|
|
|
```ts
|
|
|
|
> import { parsePackwiz } from "packwizjs";
|
2025-02-09 13:31:40 -06:00
|
|
|
> const packwizFile = await parsePackwiz("./packwiz/pack.toml")
|
2025-02-09 13:17:26 -06:00
|
|
|
Packwiz {
|
2025-02-09 13:38:42 -06:00
|
|
|
location: Resource { path: 'packwiz/pack.toml' },
|
2025-02-09 13:17:26 -06:00
|
|
|
index: { // The index file is automatically parsed alongside the pack.toml file
|
|
|
|
location: Resource { path: 'packwiz/index.toml' },
|
|
|
|
hash: '6ce48b376540c840b9c2c1eaedbdf64f3b0e1203888ea644fc5d8fff66377c18',
|
|
|
|
hashFormat: 'sha256',
|
|
|
|
files: [
|
|
|
|
[IndexFileEntry],
|
|
|
|
[IndexFileEntry],
|
|
|
|
[IndexFileEntry],
|
|
|
|
[IndexFileEntry]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
name: 'PackwizJS Testing Pack',
|
|
|
|
packFormat: 'packwiz:1.1.0',
|
|
|
|
authors: [ 'cswimr', 'GalacticFactory' ],
|
|
|
|
description: 'PackwizJS Testing Pack',
|
|
|
|
version: '1.0.0',
|
|
|
|
versions: {
|
|
|
|
minecraft: '1.21.4',
|
|
|
|
fabric: '0.16.10',
|
|
|
|
forge: undefined,
|
|
|
|
neoforge: undefined,
|
|
|
|
quilt: undefined,
|
|
|
|
liteloader: undefined
|
|
|
|
}
|
|
|
|
}
|
2025-02-09 13:31:40 -06:00
|
|
|
> await packwizFile.index.files[2].parse()
|
2025-02-09 13:17:26 -06:00
|
|
|
{
|
|
|
|
name: 'Fabric API',
|
|
|
|
filename: 'fabric-api-0.115.1+1.21.4.jar',
|
|
|
|
side: 'both',
|
|
|
|
provider: ModrinthProvider {
|
|
|
|
hash: 'd5e9f87679b5edc9786e651fc481f8861a9cf53ed381890a1cb5e129222d6c5fa99f06045007f8e1fba02da686cdb6db2d99b334a1d23881cb56dfa199932eea',
|
|
|
|
hashFormat: 'sha512',
|
|
|
|
url: Resource {
|
|
|
|
path: 'https://cdn.modrinth.com/data/P7dR8mSH/versions/UnrycCWP/fabric-api-0.115.1%2B1.21.4.jar'
|
|
|
|
},
|
|
|
|
modId: 'P7dR8mSH',
|
|
|
|
versionId: 'UnrycCWP'
|
|
|
|
},
|
|
|
|
isOptional: false,
|
|
|
|
isDefault: true,
|
|
|
|
description: undefined
|
|
|
|
}
|
|
|
|
```
|