GithubHelp home page GithubHelp logo

vthibault / grf-loader Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 1.52 MB

Library to load and extract files from Ragnarok Online GRF files

TypeScript 67.51% JavaScript 32.49%
grf grf-loader grf-reader ragnarokonline

grf-loader's Introduction

GRF Loader

GRF is an archive file format that support lossless data compression used on Ragnarok Online to store game assets. A GRF file may contain one or more files or directories that may have been compressed (deflate) and encrypted (variant of DES).

roBrowser project license: MIT node browser lint

About

  • Only supports GRF version 0x200.
  • It's working both on node and browser environments
  • Supports DES description.
  • Avoid bloating client/server memory (by not loading the whole file into the RAM)
  • Does not supports custom encryption

Installation

npm install grf-loader

Basic usage

  • Load a grf file on node.js
  • Load a grf from the browser
  • List all files content
  • Extract a file from the GRF

Load a grf file on node.js

import {GrfNode} from 'grf-loader';
import {openSync} from 'path';

const fd = openSync('path/to/data.grf', 'r');
const grf = new GrfNode(fd);

// Start parsing the grf.
await grf.load();

Load a grf from the browser

import {GrfBrowser} from 'grf-loader';

const blob = document.querySelector('input[type="file"]').files[0];
const grf = new GrfBrowser(blob);

// Start parsing the grf
await grf.load();

List all files content

Once the GRF is loaded, it's possible to list all files included inside it

grf.files.forEach((entry, path) => {
  console.log(path);
});

Extract a file from the GRF

Once the GRF is loaded, it's possible to extract all files you need

const {data, error} = await grf.getFile('data\\clientinfo.xml');

// data is a Uint8Array data, so we transform it into text
const content = String.fromCharCode.apply(null, data);
console.log(content);

grf-loader's People

Contributors

dependabot[bot] avatar vthibault avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

greek-ro

grf-loader's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.