npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bw-casclib

v2.0.2

Published

CascLib node bindings

Downloads

1

Readme

bw-casclib

Node bindings for CascLib

Note this is a fork to support the latest version of CascLib as node-casclib has been abandoned. Only StarCraft is supported.

Installation

bw-casclib has been tested on Windows and Linux. To install using npm

npm install bw-casclib

or with yarn

yarn add bw-casclib

Usage

Reading a file synchronously.

import * as casclib from 'casclib'

const storageHandle = casclib.openStorageSync("path/to/game/directory")

const fileData = casclib.readFile("path/to/casc/file")

casclib.closeStorage(storageHandle)

Read a file asynchronously with promises.

import * as casclib from 'casclib'

casclib.openStorage("path/to/game/directory")
  .then(storageHandle => {
    return casclib.readfile("path/to/casc/file")
      .then(fileData => {
        // do things with file data

        casclibe.closeStorage(storageHandle)
      })
  })

Read a file asynchronously with callbacks.

import * as casclib from 'casclib'

casclib.openStorage("path/to/game/directory", (error, storageHandle) => {
  if(error) {
    // handle error
  }

  casclib.readFile("path/to/casc/file", (error, fileData) => {
    if(error) {
      // handle error
    }

    // do things with file data

    casclib.closeStorage(storageHandle)
  })
})

API

CASC Storage and storage info

Game Names

Possible game name values.

  • Heroes of the Storm
  • World of Warcraft
  • Diablo 3
  • Overwatch
  • Starcraft
  • Starcraft II
  • Unknown
Locales

Supported locale values

  • ALL
  • NONE
  • UNKNOWN1
  • ENUS
  • KOKR
  • RESERVED
  • FRFR
  • DEDE
  • ZHCN
  • ESES
  • ZHTW
  • ENGB
  • ENCN
  • ENTW
  • ESMX
  • RURU
  • PTBR
  • ITIT
  • PTPT
StorageInfo

Object returned by getStorageInfo

  • fileCount number of files
  • gameName name of game
  • gameBuild game build number
  • installedLocales array of installed locale names
OpenStorageCallback

Callback signature used by openStorage

(error: Error, storageHandle: any) => void

openStorageSync

Synchronously open CASC storage at path

openStorageSync(path: string, locales: string[] = [ 'ALL' ]): any
  • path Path to location of CASC storage
  • locales (defaults to [ 'ALL' ]) Array of strings of valid locales to open
  • returns a handle for the specified CASC storage

openStorage

Asynchronously open CASC storage for path and locales

openStorage(path: string): Promise<any>
openStorage(path: string, locales: string[]): Promise<any>
openStorage(path: string, callback: OpenStorageCallback): null
openStorage(path: string, locales: string[], callback: OpenStorageCallback): null
  • path Path to location of CASC storage
  • locales (defaults to [ 'ALL' ]) Array of strings of valid locales to open
  • callback (optional) Called after CASC storage has been opened
  • returns Promise if callback is not provided otherwise returns null

getStorageInfo

Get information about the opened CASC storage

getStorageInfo(storageHandle: any): StorageInfo
  • storageHandle handle returned by either openStorageSync or openStorage
  • returns a StorageInfo object

closeStorage

Close CASC storage

closeStorage(storageHandle: any): void
  • storageHandle handle returned by either openStorageSync or openStorage

Find files

FindResult

Object returned by findFiles and findFilesSync

  • fullName full path of file
  • baseName file name
  • fileSize size of file

findFilesSync

Synchronously search CASC storage for files that match the search pattern.

findFilesSync(storageHandle: any, searchPattern: string = "\*", listFilePath: string = ''): FindResult[]
  • storageHandle handle returned by either openStorageSync or openStorage
  • searchPattern (defaults to "*") Can use * to match any number of characters in the file path or ? to match a single character.
  • listFilePath (defaults to an empty string) path to file containing list of files in the CASC storage (only required for WOW)
  • returns list of FindResults

findFiles

Asynchronously search CASC storage for files that match the search pattern.

findFiles(storageHandle: any, searchPattern: string): Promise<FindResult[]>
findFiles(storageHandle: any, searchPattern: string, listFilePath: string): Promise<FindResult[]>
findFiles(storageHandle: any, searchpattern: string, callback: FindFilesCallback): null
  • storageHandle handle returned by either openStorageSync or openStorage
  • searchPattern (defaults to "*") Can use * to match any number of characters in the file path or ? to match a single character.
  • listFilePath (defaults to an empty string) path to file containing list of files in the CASC storage (only required for WOW)
  • returns Promise if callback is not provided otherwise returns null

Open and Read files in CASC storage

OpenFileCallback

Callback signature used by openFile.

(error: Error, fileHandle: any) => void
ReadFileCallback

Callback signature used by read and readFile.

(error: Error, fileData: Buffer) => void

openFileSync

Synchronously open CASC file.

openFileSync(storageHandle: any, filePath: string)
  • storageHandle handle returned by either openStorageSync or openStorage
  • filePath CASC file path for file to open
  • returns handle for opened file

openFile

Asynchronously open CASC file.

openFile(storageHandle: any, filePath: string): Promise<any>
openFile(storageHandle: any, filePath: string, callback: OpenFileCallback): null
  • storageHandle handle returned by either openStorageSync or openStorage
  • filePath CASC file path for file to open
  • callback (optional) called after file has been opened
  • returns Promise if callback is not provided otherwise returns null

readSync

Synchronously read a file in CASC storage.

readSync(fileHandle: any): Buffer
  • fileHandle handle for file to be read
  • returns Buffer with file contents

read

Asynchronously read a file in CASC storage.

read(fileHandle: any): Promise<Buffer>
read(fileHandle: any, callback: ReadFileCallback): null
  • fileHandle handle for file to be read
  • returns Promise if callback is not provided otherwise returns null

readFileSync

Synchronously read a file in CASC storage.

readFileSync(storageHandle: any, filePath: string): Buffer
  • storageHandle handle returned by either openStorageSync or openStorage
  • filePath CASC file path for file to open
  • returns Buffer with file contents

readFile

Asynchronously read a file in CASC storage.

readFile(storageHandle: any, filePath: string): Promise<Buffer>
readFile(storageHandle: any, filePath: string, callback: ReadFileCallback): null
  • storageHandle handle returned by either openStorageSync or openStorage
  • filePath CASC file path for file to read
  • callback (optional) called after file has been opened and read
  • returns Promise if callback is not provided otherwise returns null

closeFile

Close CASC file

closeFile(fileHandle: any): void
  • storageHandle handle returned by either openStorageSync or openStorage

FileReadable

Readable Stream object used to read files in CASC storage.

  • path path to the file in CASC storage
  • storageHandle handle for CASC storage
  • fileHandle handle for CASC file. If provided path and storageHandle are not required.

createReadStream

Creates a FileReadable.

createReadStream(fileHandle: any, options?: ReadableOptions): Readable
createReadStream(storageHandle: any, filePath: string, options?: ReadableOptions): Readable
  • fileHandle handle for file to be read
  • storageHandle handle returned by either openStorageSync or openStorage
  • filePath - filePath CASC file path for file to read
  • options (optional) stream options see nodejs stream docs for supported options.
  • returns a FileReadable